Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please.solve my java question Problem #2: (30 pts) Write a program that prompts the user to enter two numbers a and b and an arithmetic
please.solve my java question
Problem #2: (30 pts) Write a program that prompts the user to enter two numbers a and b and an arithmetic operator op where op can be * or /. The program then computes the result of a op b. The program should take into account the following cases: If the user enters an invalid operator, the program displays the error message "Invalid operator!". If the user enters the division operator"/" and the denominator bis 0, the program displays the error message "Division by 0 is not allowed!". Sample run 1: Enter two numbers: 15 2 Enter one of the operators (*, 7): / 15.0 / 2.0 = 7.5 Sample run 2 : Enter two numbers: 12 8 Enter one of the operators (*. /): + Invalid operator! Sample run 3: Enter two numbers: 70 Enter one of the operators (*. /): / Division by O is not allowedStep 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