Reference no: EM132085667
some one tried to answer this question and the programm did not work. any expert out there ', thanks i appreciate it.
7.11111111 program requirements
As a reminder, you should be including comments in your programs . Comments should be placed periodically throughout your program. Your comments should explain the logic of what you are doing.
You do not need to write comments before every line in your program. Instead, you should add comments at the beginning of a section of code to explain what the next few lines are trying to accomplish.
Pay close attention to the directions!! Make absolutely certain that you are doing exactly what the assignment asks you to do. If you don't understand the problem, make sure to ask your instructor or an assistant.
Part 1
Begin by creating a new Java project.
Create a new Java class inside your project folder.
The name of the class should be: TwelveDays
Write a java application program that will print the verses of the song The Twelve Days of Christmas to the screen. In this song, each verse adds one additional line of output to the song.
The first verse should print the following:
On the 1st day of Christmas my true love gave to me
A partridge in a pear tree.
The second verse should print the following:
On the 2nd day of Christmas my true love gave to me
Two turtle doves, and
A partridge in a pear tree.
The third verse should print the following:
On the 3rd day of Christmas my true love gave to me
Three French hens,
Two turtle doves, and
A partridge in a pear tree.
There are a total of 12 verses to the song, and each verse will add one additional line to the song. The final verse should print the following:
On the 12th day of Christmas my true love gave to me
Twelve drummers drumming,
Eleven pipers piping,
Ten lords a leaping,
Nine ladies dancing,
Eight maids a milking,
Seven swans a swimming,
Six geese a laying,
Five golden rings,
Four calling birds,
Three French hens,
Two turtle doves, and
A partridge in a pear tree.
After each verse is printed, ask the user to press "Enter" to continue.This will allow your program to pause after each verse to give the user time to read the verse before moving on to another.
You should NOT ask the user to press "Enter" after the last verse.
Program Restrictions
You CANNOT write tons of print statements to simply print out the entire song.
Your program MUST include a loop. The loop should be designed to repeat exactly 12 times. Each trip through the loop should print one verse to the screen.
Inside the loop, you MUST use a switch statements to control the lines that are printed to the screen.< >For the statement "On the Xth day of Christmas my true love gave to me":Begin by printing "On the X" where X is the value of your loop counter.Next, use a switch statement to print "st" or "nd" or "rd" or "th" to the screen. At this point, depending on the value of the loop counter, this will cause one of the following lines to be printed:
On the 1st
On the 2nd
On the 3rd
On the 4th
etc.Now, print the rest of the line to the screen:
" day of Christmas my true love gave to me"After the first line has been printed, use another switch statement to control which lines of the verse are printed to the screen.
Each case statement is allowed to contain a single println statement so that each case statement is printing a single line of output to the screen.