Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is JAVA PROGRAM The Railroad _Car is an interface with only one method, volume), which takes no argument and returns a double Class Tank_Car
This is JAVA PROGRAM
The Railroad _Car is an interface with only one method, volume), which takes no argument and returns a double Class Tank_Car has two private variables, radius and length, which are the bottom radius and the length of the cylinder. The volume of a Tank_Car is 1, where r is the bottom radius and 1 is the length Class Box_Car has three private variables, length, width and height, which are the three dimensions of the box. I assume you know how to compute the volume of a box. Class Refrigerator_Car is an extension of Box_Car. It has one private variable, temperature, which is the refrigerator internal temperature. The volume of Refrigerator Car is the same as Box Car. There are also a getter and a setter for the temperature You need to add other necessary methods (e.g. constructors, setters, getters) for the classes. In your main() method, you need to create only one object of Railroad_Car. Based on each line in the input file, you instantiate the Railroad Car object as either Tank Car, Box Car or Refrigerator Car. The input format is explained in the table belovw Tank (Type) 6 (Length) (Radius) BoX 5 10 5 (Type) (Length) (Width) (Height) Refrigerator (Type) 3 6 9 14 (Length) (Width) (Height) (Temperature) In your output file, output the volume for each Railroad Car (one volume per line) Sample input and output files are providedStep 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