questions1 design and implement an applet called


Questions:

1. Design and implement an applet called Circles that draws 50 circles of random diameter in random locations. If the diameter of a circle is less than a certain value, the circle is ?lled with the color yellow. If the diameter of a circle is greater than an another value, the circle is ?lled with the color green. Otherwise, the circle is drawn un?lled, in red. Ensure that in each case the entire circle appears in the visible area of the applet.

2. Write a class called SimpleSlot that simulates a simple slot machine in which three numbers between 0 and 9 are randomly selected and printed side by side. Print an appropriate statement if all three of the numbers are the same, or if any two of the numbers are the same. Continue playing until the user chooses to stop.

3. Design and implement an application that prints the verses of the song "The Twelve Days of Christmas", in which each verse adds one line. The verses of the song are:

On the 12th day of Christmas, my true love gave to me Twelve drummers drumming,
On the 11th day of Christmas, my true love gave to me Eleven pipers piping,
On the 10th day of Christmas, my true love gave to me Ten lords a leaping,
On the 9th day of Christmas, my true love gave to me Nine ladies dancing,
On the 8th day of Christmas, my true love gave to me Eight maids a milking,
On the 7th day of Christmas, my true love gave to me Seven swans a swimming,
On the 6th day of Christmas, my true love gave to me Six geese a laying,
On the 5th day of Christmas, my true love gave to me Five golden rings,
On the 4th day of Christmas, my true love gave to me Four calling birds,
On the 3rd day of Christmas, my true love gave to me Three French hens,
On the 2nd day of Christmas, my true love gave to me Two turtle doves, and
On the 1st day of Christmas, my true love gave to me A partridge in a pear tree.

Write a class called TwelveDays that prompts the user to enter the last day (from 1 to 12) and prints the relevant lines of the song from the ?rst to the last day. Use a switch statement in a loop to control which lines get printed. Use a separate switch statement to put the appropriate suffix on the day number (1st, 2nd, 3rd, etc.).

Solution Preview :

Prepared by a verified Expert
JAVA Programming: questions1 design and implement an applet called
Reference No:- TGS0484345

Now Priced at $40 (50% Discount)

Recommended (93%)

Rated (4.5/5)