Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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) 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
Step: 1
Heres a Java program with a main method to test the given three methods and their overloaded version...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