Java Programming
Java Programming
9th Edition
ISBN: 9780357616635
Author: Joyce Farrell
Publisher: CENGAGE L
bartleby

Videos

Question
Book Icon
Chapter 5, Problem 10PE
Program Plan Intro

The Twelve Days of Christmas

Program plan:

  • Import necessary package.
  • Create a class “TwelveDays”,
    • Define the method “main ()”,
      • Declare the necessary variables.
      • Assign the value returned from the method “get_Choice()”.
      • Check whether the choice is greater than or equal to “4”,
        • Set the suffix to “th”.
      • Otherwise, check whether the choice is “3”,
        • Set the suffix to “rd”.
      • Otherwise, check whether the choice is “2”,
        • Set the suffix to “nd”.
      • Otherwise,
        • Set the suffix to “st”.
      • Print the choice with the day of Christmas song.
      • Execute switch statement for the given choice,
        • If the choice is “12”,
          • Print the corresponding messages until “break” occurs.
            • If the choice is “11”,
              • Print the corresponding messages until “break” occurs.
            • If the choice is “10”,
              • Print the corresponding messages until “break” occurs.
            • If the choice is “9”,
              • Print the corresponding messages until “break” occurs.
            • If the choice is “8”,
              • Print the corresponding messages until “break” occurs.
            • If the choice is “7”,
              • Print the corresponding messages until “break” occurs.
            • If the choice is “6”,
              • Print the corresponding messages until “break” occurs.
            • If the choice is “5”,
              • Print the corresponding messages until “break” occurs.
            • If the choice is “4”,
              • Print the corresponding messages until “break” occurs.
            • If the choice is “3”,
              • Print the corresponding messages until “break” occurs.
            • If the choice is “2”,
              • Print the corresponding messages until “break” occurs.
            • If the choice is “1”,
              • Print the corresponding messages until “break” occurs.
              • Exit the switch using “break”.
            • If invalid choice entered, print invalid message by default.
    • Define the method “get_Choice()”,
      • Declare the necessary variables.
      • Assign the value entered into the dialog box.
      • Parse the input.
      • Return the choice.

Blurred answer
Students have asked these similar questions
Browse the web to locate the lyrics to the song “The Twelve Days of Christmas.” The song contains a list of gifts received for the holiday. The list is collective so that as each “day” passes, a new verse contains all the words of the previous verse, plus a new item. Write an application that displays the words to the song starting with any day the user enters. (Hint: Use a switch statement 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.)
True or False: Adding more control variables will always increase the R 2 value.  True  False
switch_player(): we will allow the players to choose their own names, but for our purposes, it is easier to think of them as number (0 and 1, for indexing purposes). We will display their names to them on the screen, but in the background, we will keep track of them based on their number. This function should take 1 argument, an integer (either 0 or 1) representing the player and should return the opposite integer (1 if 0 is entered and 0 if 1 is entered). This is a simple function, but it will make our code cleaner later. Use your constants!  Using Thonny
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
CPP Function Parameters | Returning Values from Functions | C++ Video Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=WqukJuBnLQU;License: Standard YouTube License, CC-BY