Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming. Below are the lyrics for the song The Twelve Days of Christmas. The song contains a list of gifts received for the holiday.

Java programming. Below are the lyrics for the song The Twelve Days of Christmas. The song contains a list of gifts received for the holiday. The list is cumulative so that as each day passes, a new verse contains all the words of the previous verse, plus a new item.

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.

Write an application that displays the words to the song starting with any day the user enters. (Hint: Use a switchstatement with cases in descending day order and without any break statements so that the lyrics for any day repeat all the lyrics for previous days.)

Given code:

import java.util.*;

public class TwelveDays {

Scanner input = new Scanner(System.in);

public static void main (String args[]) {

// Write your code here

}

public static int getChoice() {

// Write your code here

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions