Question: Instructions Start NetBeans. Create a new project called Lab6 with a main class called YournameLab6 with your name. Write the framework for a menu-based interface.
Instructions
Start NetBeans.
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 variable that will be used to determine if a loop should keep going. Initialize it to true.
Display a welcome message with your name.
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.
Display the following menu:
choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program
Read an int from the user and store it in a variable.
Use that variable as a controlling expression for a switch statement.
For cases 1 and 2, output the following and exit the switch statement:
code goes here
For cases 3 and 4, output the following and exit the switch statement:
code goes here
For case 5, set the boolean variable to false and exit the switch statement.
For the default case output the following and exit the switch statement:
choice
Outside of the loop, display a thank-you message with your name.
Run your program to see if it works. Here is an example of what the output should look like:
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
Write the code for the arithmetic quizzes.
Create a named constant that represents the maximum value that you will use for your quizzes and tables. Initialize it to 12.
Remove the Quiz code goes here output statement.
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:
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
After the do-while statement, initialize a variable to keep track of how many questions the user got right to zero.
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.
In the body of the for statement, do the following
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.
Read an int from the user and store it in a variable.
If the users answer is correct, increment the number of questions the user got right.
After the for statment, display how many quiz questions the user got right.
Run your program to see if it works. Here is an example of what the output should look like:
choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program 1
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
Write the code for the arithmetic tables.
Remove the Quiz code goes here output statement.
Display four spaces followed by a | character.
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.
On the next line display four - characters followed by a + character.
Use a for loop to display four - characters under the column headings in the previous line.
The output so far should look like this:
| 1 2 3 4 5 6 7 8 9 10 11 12 ----+------------------------------------------------
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.
The row headings should look like this:
1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12|
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.
Run your program to see if it works. Here is an example of what the output should look like:
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 9 10 11 12 ----+------------------------------------------------ 1| 1 2 3 4 5 6 7 8 9 10 11 12 2| 2 4 6 8 10 12 14 16 18 20 22 24 3| 3 6 9 12 15 18 21 24 27 30 33 36 4| 4 8 12 16 20 24 28 32 36 40 44 48 5| 5 10 15 20 25 30 35 40 45 50 55 60 6| 6 12 18 24 30 36 42 48 54 60 66 72 7| 7 14 21 28 35 42 49 56 63 70 77 84 8| 8 16 24 32 40 48 56 64 72 80 88 96 9| 9 18 27 36 45 54 63 72 81 90 99 108 10| 10 20 30 40 50 60 70 80 90 100 110 120 11| 11 22 33 44 55 66 77 88 99 110 121 132 12| 12 24 36 48 60 72 84 96 108 120 132 144
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
Make sure your code is indented properly and you have CSCI 1011 Lab 6, your name, and a brief description of your program in the Javadoc comments before the class declaration.
Upload the file YournameLab6.java to the drop box folder labeled Lab Assignment 6.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
