Question: 1) -Write a main method to test the following three methods. A) This getArea method returns the area of a rectangle public static double

1) -Write a main method to test the following three methods. A) 

1) -Write a main method to test the following three methods. A) This getArea method returns the area of a rectangle public static double getArea(int length, int width) { } return length width; B) This getAreaCir method returns the area of a circle. public static double getAreaCir (double radius) 1 return Math.PI * radius radius; } c) This getArea method returns the area of a cylinder. public static double getAreaCyl (double radius, double height). { return Math.PI radius radius * height; 2) Over load the above three methods and call those form main Hint- public static double getArea (int length, int width) (...3 lines ) public static double getArea (double radius, double height) (...3 lines) public static double getArea (double radius) (...3 lines )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a Java program with a main method to test the given three methods and their overloaded version... View full answer

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 Programming Questions!