Question: Create a new Java project and make sure Create project from template is UNCHECKED ) . Use a meaningful name such as M 5 -

Create a new Java project and make sure "Create project from template" is UNCHECKED). Use a meaningful name such as M5-PA-AreaCalculator. Then create a new Java class called AreaCalculator in the src folder. Add a main method to this class. The program should follow the guidelines below. In this program, you will create an area calculator that can calculate the area of circles, triangles, rectangles, squares, and trapezoids, given the correct input. This area calculator will depend on several methods that you need to create. Specifically, they are: printOptions(): this method prints out the title and menu options of the program. It does not require any arguments and does not return anything. pi(): this method does not require any argument and return a constant, 3.14159(not 3.14), to the caller. circle(): this method requires a radius as its argument and will return the area of a circle based on the radius. This function must call the pi method you defined in the calculation. triangle(): this method requires two arguments: a base and a height. It will return the area of a triangle based on the arguments. rectangle(): this method requires two arguments: a width and a height. It will return the area of a rectangle based on the arguments. square(): this method requires one argument, a side, and it will return the area of a square based on the argument. trapezoid(): this method requires three arguments, a top, a bottom, and a height. It will return the area of a trapezoid based on the arguments. Your program should keep running until the user enters 0.(See the sample run below) Sample Run The output below represents ONE execution. User inputs are labeled in red. ********** Area Calculator **********0) Exit 1) Circle 2) Triangle 3) Rectangle 4) Square 5) Trapezoid Please enter your option (0-5): 1 Please enter the radius of the circle: 5.2 The area of the circle is 84.949.********** Area Calculator **********0) Exit 1) Circle 2) Triangle 3) Rectangle 4) Square 5) Trapezoid Please enter your option (0-5): 2 Please enter the base of the triangle: 10 Please enter the height of the triangle: 4.6 The area of the triangle is 23.000********** Area Calculator **********0) Exit 1) Circle 2) Triangle 3) Rectangle 4) Square 5) Trapezoid Please enter your option (0-5): 3 Please enter the width of the rectangle: 2.5 Please enter the height of the rectangle: 6.5 The area of the rectangle is 16.250********** Area Calculator **********0) Exit 1) Circle 2) Triangle 3) Rectangle 4) Square 5) Trapezoid Please enter your option (0-5): 4 Please enter the side of the square: 4.56789 The area of the square is 20.866********** Area Calculator **********0) Exit 1) Circle 2) Triangle 3) Rectangle 4) Square 5) Trapezoid Please enter your option (0-5): 5 Please enter the top of the trapezoid: 1.2 Please enter the bottom of the trapezoid: 3.4 Please enter the height of the trapezoid: 6 The area of the trapezoid is 13.800********** Area Calculator **********0) Exit 1) Circle 2) Triangle 3) Rectangle 4) Square 5) Trapezoid Please enter your option (0-5): 6 Unknown option 6. Please try again. ********** Area Calculator **********0) Exit 1) Circle 2) Triangle 3) Rectangle 4) Square 5) Trapezoid Please enter your option (0-5): 0 Requirements All methods mentioned above must be declared as public static ... Valid options from users are from 0 to 5, where 0 will terminate the program. The program should output an error message but continue running. The program must repeat until the user ends it with 0 being entered as the option. Must use switch statement in main(). Must call pi method in the circle method. All numerical outputs must be exactly 3 decimal places.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!