Sale!

COMP 1123 ASSIGNMENT 9 solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (4 votes)

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:
• CountDigits.java
• Coin.java
• Race.java
• Stairs
• StairsPanel