Programming assighment

FratBro23
Category:
Programming
Price: $5 USD

Question description

Write a class  that has three overloaded static  methods  for calculating the areas of the
following geometric shapes:

• circles -- area = π*radius^2 (format the answer to have two decimal places)
• rectangles -- area = width * length
• trapezoid -- area = (base1 + base2) * height/2

Because the three methods  are to be overloaded, they should each have the same name , but
different parameters  (for example, the method  to be used with circles should only take
one parameter , the radius of the circle).

Demonstrate the methods  by adding a main method  that prints out the following areas, each on a
separate line:

• the area of a circle with radius 3
• the area of a rectangle with length 2 and width 4
• the area of a trapezoid with base lengths 3 and 5 and height 5


SAMPLE RUN #1

--- Prompts For Keyboard/Console/Standard Input ---


Inputs


Outputs 

--- Monitor/Console/Standard Output  ---

28.27
8.0
17.5

What The Console Looks Like In An Interactive Session:

(Note: this combines standard input with standard output )

>java Area
28.27
8.0
17.5


Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1824 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors