Write My Paper Button

WhatsApp Widget

import java.util.Scanner; public class TwelveDays {    public static void main(String[] args)    {       final…

Homework Help Question & Answers

import java.util.Scanner; public class TwelveDays {    public static void main(String[] args)    {       final…

import java.util.Scanner;

public class TwelveDays
{
   public static void main(String[] args)
   {
      final int MAX = 12;
      int lastDay = 0; //last day for the song, user will update
      Scanner scan = new Scanner(System.in);

      //Get the last day and use input validation

//Begin 1st while
      {

      }
      
      
      int day = 1;      //loop control variable for song verses
     

//Begin 2nd while
      {
         //Output: “On the” + day

         //Output the suffix for the day

         //Begin 1st switch

         {

         }

         //Output ” day of Christmas my true love gave to me “

         //Output the gift

         //Begin 2nd switch

         {

           }

         //Increment the loop control variable
    }
}

}

ris as Write a program that prints the verses of the song “The Twelve days of Christmas” in which each verse adds one line. The user should enter one of the twelve days and the code should output the song, starting from the first verse Here is the final verse for reference 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 You will need: 1. An assignment statement to store the day entered 2. A while loop for input validation. The user should ONLY be able to enter a day between 1 and 12 3. A second while loop to output the verses 1. In this loop you will use two switch statements 1. The first switch statement should add the appropriate suffix to the day. (Day 1 should be 1st, day 2 should be 2nd, day 3 should be 3rd, and all other days should en with “th”.) 2. The second switch statement should output the gift for the particular day. You should utilize the fall through method for this switch statement (in order words, don’t use the break statement in this one.) Please stick to the format shown in the final verse and in the sample output. All gifts should appear on a new line
0 0
Add a comment
Don`t copy text!
WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!
???? Hi, how can I help?