Question: 1) Write a class called SodaCan that contains instance data for the height and diameter of the soda can. (70 points) Define the SodaCan constructor
1) Write a class called SodaCan that contains instance data for the height and diameter of the soda can. (70 points)
Define the SodaCan constructor to accept and initialize the height and diameter of the soda can.
Overload the Sodacan constructor such that the initial value of instance data (height and diameter) are 0.
Include getter and setter method for all instance data.
Provide a method getVolume to find the volume of the soda can.
Provide a method getSurfaceArea to find the surface area of the soda can.
2) Create a diver class SodaCanTest with main method. (30 points)
Driver class instantiate one soda can object and find its volume and surface area.
Driver class create another soda can object and read its height and diameter value, then output this soda can objects volume and surface area.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
