1. Create a menu that prompts the student for the type of math problem they would...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Create a menu that prompts the student for the type of math problem they would like to solve. See menu below. Welcome to the Math Program 1. Addition 2. Subtraction 3. Multiplication 4. Division Enter your choice: 2. Next, using the Scanner class, retrieve the number of the menu choice that was entered by the student. If the student does not enter 1,2,3,4 print an error message and stop the program. a. Don't forget to import java.util.Scanner; 3. Using a random number generator, generate two single-digit integers (between 0 and 9, inclusive). You have a couple of options to do this. i. ii. Random class: 1. To use: import java.util.Random; 2. To generate a random integer between 1 and 52: Random rand = new Random(); int num = rand.nextInt(52) + 1; Math class: 1. No import needed (included in java.lang so accessible by default) 2. Math.random(). This will generate a double between 0 and 1, so I will have to use arithmetic and explicit casting to obtain a number in the specified interval: int num = (int) (Math.random() *52+1); 4. Next, display the equation and prompt the student for the answer ii. Math class: 1. No import needed (included in java.lang so accessible by default) 2. Math.random(). This will generate a double between 0 and 1, so I will have to use arithmetic and explicit casting to obtain a number in the specified interval: int num = (int) (Math.random() *52+1); 4. Next, display the equation and prompt the student for the answer 5. Check the student's answer and display "Correct" or "Incorrect" depending on whether they got it right or wrong, respectively. a. For division: you may choose to use integer division or round the result of the expression (but be sure to tell the user what you'll do so they know what answer to put in). b. If you choose to compare floating-point values, remember that you cannot use == to test equality with precision like you can with integers. 1. Create a menu that prompts the student for the type of math problem they would like to solve. See menu below. Welcome to the Math Program 1. Addition 2. Subtraction 3. Multiplication 4. Division Enter your choice: 2. Next, using the Scanner class, retrieve the number of the menu choice that was entered by the student. If the student does not enter 1,2,3,4 print an error message and stop the program. a. Don't forget to import java.util.Scanner; 3. Using a random number generator, generate two single-digit integers (between 0 and 9, inclusive). You have a couple of options to do this. i. ii. Random class: 1. To use: import java.util.Random; 2. To generate a random integer between 1 and 52: Random rand = new Random(); int num = rand.nextInt(52) + 1; Math class: 1. No import needed (included in java.lang so accessible by default) 2. Math.random(). This will generate a double between 0 and 1, so I will have to use arithmetic and explicit casting to obtain a number in the specified interval: int num = (int) (Math.random() *52+1); 4. Next, display the equation and prompt the student for the answer ii. Math class: 1. No import needed (included in java.lang so accessible by default) 2. Math.random(). This will generate a double between 0 and 1, so I will have to use arithmetic and explicit casting to obtain a number in the specified interval: int num = (int) (Math.random() *52+1); 4. Next, display the equation and prompt the student for the answer 5. Check the student's answer and display "Correct" or "Incorrect" depending on whether they got it right or wrong, respectively. a. For division: you may choose to use integer division or round the result of the expression (but be sure to tell the user what you'll do so they know what answer to put in). b. If you choose to compare floating-point values, remember that you cannot use == to test equality with precision like you can with integers.
Expert Answer:
Related Book For
Operations Management Creating Value Along the Supply Chain
ISBN: 978-0470525906
7th Edition
Authors: Roberta S. Russell, Bernard W. Taylor
Posted Date:
Students also viewed these programming questions
-
1. Develop a clear profile of your typical customer by describing them in relevant demographic terms including: age, gender, income, marital status, education, religion, profession, and geographic...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
3. Show how accounts receivable will appear on the December 31, 2023, balance sheet. Assets Current assets: Partial Balance Sheet Accounts receivable Less: Allowance for doubtful accounts 22,525
-
The time required for kindergarten children to assemble a specific Lego creation was measured for children who had been instructed for four different lengths of time. Four children were randomly...
-
Whether healthcare should be free for all citizens, and introduce a fallacy argument and provide at least one supportive point, one legitimate objection, your assessment of that objection, and a...
-
Predicting Flight Delays (Bootstrap Forest and Boosted Trees). We return to the flight delays data for this exercise, and fit both a bootstrap forest and a boosted tree to the data. Use scheduled...
-
Mr. O earned an $89,000 salary, and Mrs. O earned a $40,330 salary. The couple had no other income and cant itemize deductions. a. Compute their combined tax if they file separate returns. b. Compute...
-
Convert the following decimal numbers to the base indicated: 1. 175 to binary 2. 25.86 to binary 3. 1938 to hexadecimal 4. 5386 to hexadecimal
-
Find a, b, c, and d so that [a b c d]+[-6 2 -6 8] = [0 10 -1 -8]
-
A pair of shoes that wholesales for $28.79 has approximately the following costs: a. Which of these costs would likely be a variable cost? b. Which would likely be a fixed cost? c. If output were to...
-
What factors should a firm considering marketing its innovation in multiple countries use in formulating its protection strategy?
-
Write a Verilog description for the sequential circuit given by the state diagram in Figure 4-19(d). Include an asynchronous RESET signal to initialize the circuit to state Init. Compile your...
-
Pick a company you are familiar with. Can you identify some of its core competencies?
-
A sequential circuit has two lip- lops A and B, one input X, and one output Y. The state diagram is shown in Figure 4-54. Design the circuit with D lip- lops using a one- hot state assignment. Figure...
-
On January 1, Year 1, Acorn Financial Corp. issued 850 convertible bonds. Each $1,000 face value bond is convertible into 5 shares of common stock. The bonds have a 10 year term to maturity and pay...
-
a. Why does the Wi-Fi Alliance release compatibility testing profiles in waves instead of combining the entire standards features initially? 27a1.) An 802.11ac Wi-Fi compatibility testing profile...
-
Given the four criteria necessary for a sale to be complete, which of the following is not one of those conditions? 1. Delivery has occurred or services rendered. 2. Cash has been collected. 3. The...
-
What is the difference between a business and a pure charity? Between a business and a governmental agency?
-
Sketch the \(P-V\) phase diagram for helium-4 using the sketch of the \(P-T\) phase diagram in Figure 4.3. Ps P S superfluid Pe T To T FIGURE 4.3 Sketch of the P-T phase diagram for helium-4. The...
Study smarter with the SolutionInn App