Question: Answer Q1(a)-Q1(b) using Java based on the formulas for calculating the volume of the shapes given in FIGURE Q1. Volume of a cylinder: Volume =

Answer Q1(a)-Q1(b) using Java based on the formulas for calculating the volume of the shapes given in FIGURE Q1. Volume of a cylinder: Volume = nrh Volume of a cuboid: Volume = length x width x height where n is Math.PI, r is the radius, h is the height FIGURE Q1 (a) Write a class named Volume that has two (2) overloaded static methods for calculating the volume of two (2) 3D shapes: cylinder, and cuboid. Implement the methods in a complete class. (9 marks) (b) Write a class named, Testvolume to use the overloaded static methods written for Q1(a). The class shall display the volume for each of the 3D shapes mentioned in FIGURE Q1. (6 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
