Question: Write a Java program. 1) Generate two random numbers between 2 and 10. 2) Ask user to choose one operator from +, -, *,/

Write a Java program. 1) Generate two random numbers between 2 and

Write a Java program. 1) Generate two random numbers between 2 and 10. 2) Ask user to choose one operator from +, -, *,/ (note: / is an integer division) 3) Display Math formula using the numbers and the operator. (eg: 6 * 7 = ?) 4) Ask the user for an answer. If the user's answer is correct, display "You are a math genius! Bye." and terminate the program. If the user's answer is incorrect. Display "wrong answer!" and ask the user for the answer of the formular again. (Do not generate new numbers and formula.) 5) To calculate the answer, create a method and send/return the operator and two numbers. Like, . public static int math(String op, int a, int b) { int result = 0; if (op.equals("+") {result=...;} return result; } 6) you must pass 3 parameters (operator, first number, second number) to the math method and receive the result from the method. 7) Include appropriate program comments and formatting including: Your first and last name, a short description of the program's function and comments necessary to explain the operation of your program

Step by Step Solution

3.46 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Program name Math Challenge Author John Doe Description The program will generate two random numbers between 2 and 10 and ask the user to choose one operator from or integer division It will display a ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!