Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help,I am stuck question number 5.C Thanks equired Reading vitch.4.1-4.2 structions 1 Start NetBeans 2. Create a new project called Labs with a
I need help,I am stuck question number 5.C Thanks
equired Reading vitch.4.1-4.2 structions 1 Start NetBeans 2. Create a new project called Labs with a main class called YournameLabo with your name 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. (Use that variable as a controlling expression for a switch statement (8) 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 0 For case 5, set the boolean variable to false and exit the switch statement 0 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. Run your program to see if it works. Here is an example of what the output should look like: 4. 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 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 (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 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. in 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. 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 Run your program to see if it works. Here is an example of what the output should look like: 6. 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 10 11 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. (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 (0) The output so far should look like this: 11 2 3 5 6 7 8 9 10 11 12 (8) 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 headings should look like this: (0) 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 Please choose from the following options: 1. Addition Quiz 2. Multiplication Quiz 3. Addition Table 4. Multiplication Table 5. Exit the program 1 1 2 3 4 5 6 7 8 9 10 11 12 3 12 12 18 20 7 14 21 28 35 42 5 10 15 20 25 30 35 11 2 2 4 3 3 6 8 5 5 10 6 6 12 7 7 8 8 16 18 10 10 20 11 11 22 12 12 12 15 18 21 30 36 11 16 24 27 30 32 45 50 55 50 72 56 63 72 80 88 96 72 81 99 108 se s@ 100 110 129 88 99 119 121 182 96 108 129 132 166 32 36 40 48 54 60 27 30 33 36 45 50 55 60 56 63 70 77 84 48 72Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started