Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

With this program you are going to design a math practice program for younger users. You will ask the user to enter two numbers. Only

With this program you are going to design a math practice program for younger users. You will ask the user to enter two numbers. Only numbers may be entered. If the user enters a word, the program should disregard the entry and wait for an integer entry. There will not be another prompt if the user enters data other than whole numbers (integers).

Here is a sample run: Your static methods should accept two integers and return an integer. Do not worry about testing for division by 0 because that won't be one of the tests. Your methods will be named: addNumbers subtractNumbers multiplyNumbers divideNumbers The methods will be static. After each run, the program will ask if the user wishes to quit: Here is the prompt to quit the program: System.out.println("Enter 'Quit' to end the program."); Here are the prompts to read in the choices: System.out.println("Enter 1 to add the two numbers."); System.out.println("Enter 2 to subtract the second number from the first number."); System.out.println("Enter 3 to multiply the two numbers."); System.out.println("Enter 4 to divide the first number by the second number."); Here is the prompt to read in the two numbers: System.out.println("Enter two integers:"); Here is the welcome prompt: System.out.println("Welcome to *Mental Math Practice* where you can test your addition, subtraction, multiplication, and division."); Use a Scanner to read in the data from the console.

this is what the professor gave me

import java.util.Scanner;

/** * * @author dfreer */ public class MathTeacher {

/** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("Welcome to *Mental Math Practice* where you can test your addition, subtraction, multiplication, and division."); System.out.println("Enter two integers:");

System.out.println("Enter 1 to add the two numbers."); System.out.println("Enter 2 to subtract the second number from the first number."); System.out.println("Enter 3 to multiply the two numbers."); System.out.println("Enter 4 to divide the first number by the second number.");

System.out.println("Enter 'Quit' to end the program."); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions