Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

Conduct an effective performance feedback session. page 360

Answered: 1 week ago