In this lab, you complete a partially written Java program that includes a method that returns a value. The program is a simple calculator that prompts the user for two numbers and an operator ( +, −, *, /,or% ). The two numbers and the operator are passed to the method where the appropriate arithmetic operation is performed. The result is then returned to the main() method where the arithmetic operation and result are displayed. For example, if the user enters 3, 4, and *, the following is displayed: 3.00 * 4.00 = 12.00 The source code file provided for this lab includes the necessary variable declarations, and input and output statements. Comments are included in the file to help you write the remainder of the program. Instructions
Writing Methods that Return a Value in Java
In this lab, you complete a partially written Java program that includes a method that returns a value. The program is a simple calculator that prompts the user for two numbers and an operator ( +, −, *, /,or% ). The two numbers and the operator are passed to the method where the appropriate arithmetic operation is performed. The result is then returned to the main() method where the arithmetic operation and result are displayed. For example, if the user enters 3, 4, and *, the following is displayed:
3.00 * 4.00 = 12.00
The source code file provided for this lab includes the necessary variable declarations, and input and output statements. Comments are included in the file to help you write the remainder of the program.
Instructions
- Write the Java statements as indicated by the comments.
- Execute the program
USE THE GIVEN CODE
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images