Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 provided

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions