Description
question 1
Write a program called CountDigits which reads in an integer. You can assume the input will be a valid positive integer. Then, for each digit that appears in the input, print out the number of times it occurs. Use a switch statement in your program.
question 2
This question uses the Coin class from Chapter 5. Do not modify it. Write the class Race which creates 1 Coin object. Flip the coin and count the number of times a head/tail appears. Stop flipping when you reach either 10,000 heads or 10,000 tails.
question 3
Write the classes Stairs and StairsPanel. Stairs will first ask the user for a number of stairs. It will then display a black panel which contains white stairs from the lower left corner to the top right corner. The number of equal sized stairs depends on the integer entered by the user and does not change when the window is resized. The last stair drawn may not end exactly in a corner due to round off errors with integers.
The above stairs are white. The screen capture transformed them to blue…
what to submit
Submit Assignment9.zip which contains:
- java
- java
- java
- Stairs
- StairsPanel