Question
JAVA This practice will acquaint you with the use of parameter passing, return values, if/else blocks, and user inputs. You will complete the following program
JAVA
This practice will acquaint you with the use of parameter passing, return values, if/else blocks, and user inputs. You will complete the following program that prompts the user for a set of information, then executes simple algebra on those values and returns a summary report which includes name and size of each shape and comparison result. Your program should perform the following:
- Prompt the user for the width of the rectangle (data type: double).
- Prompt the user for the height of the rectangle (data type: double).
- Prompt the user for the radius of the circle (data type: double).
- Call a method and pass the width and height to calculate the area of the rectangle.
- The method will return the result (area of the rectangle).
- Call a method and pass the radius to calculate the area of the circle.
- The method will return the result (area of the circle).
- Display the result of each shape. This should be done in the main method.
- Compare the size and display comparison result. See the example below.
Example log of execution is as follow (user inputs are in bold and underlined):
Input rectangle width: 10.0 Input rectangle height: 50.0 Input circle radius: 10.0 //output
Rectangle area: 500.0 Circle area: 314.15
The area of the rectangle seems 1.591596371160274 times bigger than the area of the circle.
Include appropriate program comments:
1. Comments necessary to explain the operation of your program
2. Proper indentation
Step 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