Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Create a new project called Lab6 with a main class called YournameLab6 with your name. Write the framework for a menu-based interface. Declare a boolean

  1. Create a new project called Lab6 with a main class called YournameLab6 with your name.
  2. Write the framework for a menu-based interface.
    1. Declare a boolean variable that will be used to determine if a loop should keep going. Initialize it to true.
    2. Display a welcome message with your name.
    3. Write a do-while loop that uses the boolean variable as a loop condition. The remaining steps should all appear in the body of the loop, unless stated otherwise.
    4. Display the following menu:
  • Please choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program
  1. Read an int from the user and store it in a variable.
  2. Use that variable as a controlling expression for a switch statement.
  3. For cases 1 and 2, output the following and exit the switch statement:
  • Quiz code goes here
  1. For cases 3 and 4, output the following and exit the switch statement:
  • Table code goes here
  1. For case 5, set the boolean variable to false and exit the switch statement.
  2. For the default case output the following and exit the switch statement:
  • Invalid choice
  1. Outside of the loop, display a thank-you message with your name.
  2. Run your program to see if it works. Here is an example of what the output should look like:
  • Welcome to Nicholas Coleman's arithmetic quiz program Please choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program 1 Quiz code goes here Please choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program 4 Table code goes here Please choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program 5 Thank you for using John Leslie's arithmetic quiz program
  1. Write the code for the arithmetic quizzes.
    1. Create a named constant that represents the maximum value that you will use for your quizzes and tables. Initialize it to 12.
    2. Remove the Quiz code goes here output statement.
    3. Replace it with a do-while statement that repeatedly prompts for a value between 1 and the maximum value constant until the value entered is within the range specified. The output should look something like this:
  • Please choose a number between 1 and 12 0 Please choose a number between 1 and 12 13 Please choose a number between 1 and 12 8
  1. After the do-while statement, initialize a variable to keep track of how many questions the user got right to zero.
  2. Write a for statement that starts a counter at 1, increments it by 1 at each iteration, and exits when the counter exceeds the maximum value constant.
  3. In the body of the for statement, do the following
    1. Display a quiz question of the form NUM OP COUNTER =, where NUM is the number the user chose, OP is either + or * depending on the menu choice, and COUNTER is the counter.
    2. Read an int from the user and store it in a variable.
    3. If the user's answer is correct, increment the number of questions the user got right.
  4. After the for statment, display how many quiz questions the user got right.
  5. Run your program to see if it works. Here is an example of what the output should look like:
  • Please choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program 1

  • Please choose a number between 1 and 12 8 8 + 1 = 9 8 + 2 = 10 8 + 3 = 11 ... 8 + 10 = 18 8 + 11 = 19 8 + 12 = 20 You got 12 right out of 12 Please choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program 5 Thank you for using John Leslie's arithmetic quiz program
  1. Write the code for the arithmetic tables.
    1. Remove the Quiz code goes here output statement.
    2. Display four spaces followed by a | character.
    3. Use a for loop to display the column headings on the same line, which should start at one and go up to the maximum value constant. Each column heading should take up four characters.
    4. On the next line display four - characters followed by a + character.
    5. Use a for loop to display four - characters under the column headings in the previous line.
    6. The output so far should look like this:
  • | 1 2 3 4 5 6 7 8 910 11 12 ----+------------------------------------------------
  1. Use a for loop to display each of the row headings on a different line. Each row heading should take up four characters followed by a | character.
  2. The row headings should look like this:
  • 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12|
  1. Inside of the row heading loop, write a nested for loop that displays a row of the table. Each entry should take up 4 characters and contain the result of adding or multiplying the row and column numbers depending on the menu option chosen by the user.
  2. Run your program to see if it works. Here is an example of what the output should look like:
  • Please choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program 4 | 1 2 3 4 5 6 7 8 910 11 12 ----+------------------------------------------------ 1| 1 2 3 4 5 6 7 8 910 11 12 2| 2 4 6 8 10 1214 16 1820 22 24 3| 3 6 912 15 1821 24 2730 33 36 4| 4 8 12 16 20 2428 32 3640 44 48 5| 510 15 20 25 3035 40 4550 55 60 6| 612 18 24 30 3642 48 5460 66 72 7| 714 21 28 35 4249 56 6370 77 84 8| 816 24 32 40 4856 64 7280 88 96 9| 918 27 36 45 5463 72 8190 99 108 10| 1020 30 40 50 6070 80 90 100 110 120 11| 1122 33 44 55 6677 88 99 110 121 132 12| 1224 36 48 60 7284 96 108 120 132 144

  • Please choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program 5 Thank you for using John Leslie's arithmetic quiz program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Creating Arithmetic quiz using NetBeans First Create new project in NetBeans IDE class name sa YournameLab6 write the display menu in interface choose from the following options 1 Addition Quiz 2 Mult... 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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Systems analysis and design

Authors: kenneth e. kendall, julie e. kendall

8th Edition

135094909, 013608916X, 9780135094907, 978-0136089162

More Books

Students explore these related Programming questions

Question

What is really the cause of the conflict?

Answered: 3 weeks ago