Java Programming (MindTap Course List)
Java Programming (MindTap Course List)
9th Edition
ISBN: 9781337397070
Author: Joyce Farrell
Publisher: Cengage Learning
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
Create a Database in JAVA OOP that saves name of the player and how many labyrinths did the player solve. Record the number of how many labyrinths did the player solve, and if he loses his life, then save this number together with his name into the database. Create a menu item, which displays a highscore table of the players for the 10 best scores. Also, create a menu item which restarts the game. public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private void checkGameState() {        if (player.getX() == 0 && player.getY() == labyrinth.getSize() - 1) {            JOptionPane.showMessageDialog(this, "You escaped! Congratulations!");            System.exit(0);        }         if (Math.abs(player.getX() - dragon.getX()) <= 1 &&            Math.abs(player.getY() - dragon.getY()) <= 1) {            JOptionPane.showMessageDialog(this, "The dragon caught you! Game Over.");…
Change the following code so that the player can see only the neighboring fields at a distance of 3 units.   public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private final ImageIcon playerIcon = new ImageIcon("data/images/player.png");    private final ImageIcon dragonIcon = new ImageIcon("data/images/dragon.png");    private final ImageIcon wallIcon = new ImageIcon("data/images/wall.png");    private final ImageIcon emptyIcon = new ImageIcon("data/images/empty.png");     public GameGUI(Labyrinth labyrinth, Player player, Dragon dragon) {        this.labyrinth = labyrinth;        this.player = player;        this.dragon = dragon;         setFocusable(true);        addKeyListener(new KeyAdapter() {            @Override            public void keyPressed(KeyEvent e) {                char move = switch (e.getKeyCode()) {                    case KeyEvent.VK_W -> 'W';                    case…
Q/ Fill in the table below with the correct answers for the network devices and components required, then draw the topology diagram for the network of this three-story building: I want a drawing Cisco Packet tracer Ground Floor: This floor will house the main server room, reception area, and a few conference rooms. The server room should contain the core network devices that will connect the entire building. The reception area and conference rooms need network access require access for mobile devices for visitors and guests with devices. First Floor: This floor is dedicated to offices with workstations, each needing reliable network connectivity for staff computers, IP phones, IP camera, and printers. Second Floor (Education Department): This floor consists of educational spaces requiring controlled internet access. Only the educational website (https://uokerbala.edu.iq) should be accessible, with all other sites restricted.. Device Media type Location floor Type of IP Static/dynamic…
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 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,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
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