Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this exercise you will write a class named Area. The Area class should provide static methods that calculate the areas of different geometric shapes.
For this exercise you will write a class named Area. The Area class should provide static methods that calculate the areas of different geometric shapes. The class should have three overloaded static methods named getArea. Here is a description of each method: 0 The first version of the static getArea method will calculate the area ofa circle. It should accept the circle's radius as a double, and return the circle's area as a double. See the formula below for calculating the area of a circle. 0 The second version of the static getArea method will calculate the area ofa rectangle. It should accept the rectangle's length and width as doubles, and return the rectangle's area as a double. See the formula below for calculating the area of a rectangle. - The third version of the static getArea method will calculate the area of a trapezoid. It should accept the trapezoid's base #1 length, base #2 length, and height as doubles, and return the trapezoid's area as a double. See the formula below for calculating the area of a trapezoid. The Area class should also have a main method that calls each of the overloaded getArea methods. It should display the following values, each on a separate line: . The area of a circle with a radius of 3. The value should be rounded to two decimal places. . The area of a rectangle with a length of 2 and a width of 4. The value should be rounded to one decimal place. . The area of a trapezoid with a base lengths of 3 and 4, and a height of 5. The value should be rounded to one decimal place. Here are the formulas for calculating the areas of the shapes: Area of a circle: Area = 1/2 where it is Math . PI and r is the circle's radius. Area of a rectangle: Area = Width x Length Area of a trapezoid: Area = (base1 + base2) x height / 2
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