Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment Write two local classes named Pump and Cylinder as described below. Then, write a main function that reads the flowSpeed and area of a
Assignment Write two local classes named Pump and Cylinder as described below. Then, write a main function that reads the flowSpeed and area of a Pump object (p) both as double values, main will also read the radius and height of a cylinder object (fuelTank) both as double values. Finally, the inBuiltPump of fuelTank will be the p Pump object. Finally, the program should calculate the time it takes the fuelTank to be completely filled with fuel and prints it to the screen as a double value. Pump Class A private double field named "flowSpeed" representing the flow speed of the pump. A private double field named "area" representing the cross-section area (i.e., kesit alan) of the pump. A constructor that gets two double values and initializes the object. An empty constructor. A public function named calculateFlow Rate that does not get any parameter, multiplies the flowSpeed and area of the pump, and returns it as a double value. Cylinder Class A private double field named "radius representing the radius of the cylinder A private double field named "height" representing the height of the cylinder A private Pump field named "inBuiltPump' representing the pump that provides fuel to this cylinder. Assignment Write two local classes named Pump and Cylinder as described below. Then, write a main function that reads the flowSpeed and area of a Pump object (p) both as double values, main will also read the radius and height of a cylinder object (fuelTank) both as double values. Finally, the inBuiltPump of fuelTank will be the p Pump object. Finally, the program should calculate the time it takes the fuelTank to be completely filled with fuel and prints it to the screen as a double value. Pump Class A private double field named "flowSpeed" representing the flow speed of the pump. A private double field named "area" representing the cross-section area (i.e., kesit alan) of the pump. A constructor that gets two double values and initializes the object. An empty constructor. A public function named calculateFlow Rate that does not get any parameter, multiplies the flowSpeed and area of the pump, and returns it as a double value. Cylinder Class A private double field named "radius representing the radius of the cylinder A private double field named "height" representing the height of the cylinder A private Pump field named "inBuiltPump' representing the pump that provides fuel to this cylinder
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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