Using Java 3. Write the framework for a menu-based interface. (a) Declare a boolean variable that will be used to determine if a loop should keep going. Initialize it to true. (b) Display a welcome message with your name. (c) 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. (d) 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 (e) Read an int from the user and store it in a variable. (f) Use that variable as a controlling expression for a switch statement.(g) For cases 1 and 2, output the following and exit the switch statement: Quiz code goes here (h) For cases 3 and 4, output the following and exit the switch statement: Table code goes here (i) For case 5, set the boolean variable to false and exit the switch statement. (j) For the default case output the following and exit the switch statement: Invalid choice (k) Outside of the loop, display a thank-you message with your name. 4. 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 program5. Write the code for the arithmetic quizzes. (a) Create a named constant that represents the maximum value that you will use for your quizzes and tables. Initialize it to 12. (b) Remove the Quiz code goes here output statement. (c) 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 (d) After the do-while statement, initialize a variable to keep track of how many questions the user got right to zero. (e) 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. (f) In the body of the for statement, do the following i. 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. ii. Read an int from the user and store it in a variable. iii. If the user’s answer is correct, increment the number of questions the user got right. (g) After the for statment, display how many quiz questions the user got right. 6. 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 1Please 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 7. Write the code for the arithmetic tables. (a) Remove the Quiz code goes here output statement. (b) Display four spaces followed by a | character. (c) 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. (d) On the next line display four - characters followed by a + character. (e) Use a for loop to display four - characters under the column headings in the previous line. (f) The output so far should look like this: | 1 2 3 4 5 6 7 8 9 10 11 12 ----+------------------------------------------------ (g) 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.(h) The row headings should look like this: 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| (i) 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Using Java

3. Write the framework for a menu-based interface.
(a) Declare a boolean variable that will be used to determine if a loop should
keep going. Initialize it to true.
(b) Display a welcome message with your name.
(c) 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.
(d) 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
(e) Read an int from the user and store it in a variable.
(f) Use that variable as a controlling expression for a switch statement.(g) For cases 1 and 2, output the following and exit the switch statement:
Quiz code goes here
(h) For cases 3 and 4, output the following and exit the switch statement:
Table code goes here
(i) For case 5, set the boolean variable to false and exit the switch statement.
(j) For the default case output the following and exit the switch statement:
Invalid choice
(k) Outside of the loop, display a thank-you message with your name.
4. 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 program5. Write the code for the arithmetic quizzes.
(a) Create a named constant that represents the maximum value that you will
use for your quizzes and tables. Initialize it to 12.
(b) Remove the Quiz code goes here output statement.
(c) 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
(d) After the do-while statement, initialize a variable to keep track of how many
questions the user got right to zero.
(e) 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.
(f) In the body of the for statement, do the following
i. 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.
ii. Read an int from the user and store it in a variable.
iii. If the user’s answer is correct, increment the number of questions the
user got right.
(g) After the for statment, display how many quiz questions the user got right.
6. 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
1Please 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
7. Write the code for the arithmetic tables.
(a) Remove the Quiz code goes here output statement.
(b) Display four spaces followed by a | character.
(c) 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.
(d) On the next line display four - characters followed by a + character.
(e) Use a for loop to display four - characters under the column headings in the
previous line.
(f) The output so far should look like this:
| 1 2 3 4 5 6 7 8 9 10 11 12
----+------------------------------------------------
(g) 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.(h) The row headings should look like this:
1|
2|
3|
4|
5|
6|
7|
8|
9|
10|
11|
12|
(i) 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

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Fundamentals of system reliability
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education