Question: Contents Attributes: name: Stringdensity: doublevalue: double Methods: getName ( ) : StringgetDensity ( ) : doublegetValue ( ) : doublesetValue ( value: double ) :

Contents
Attributes:
name: Stringdensity: doublevalue: double
Methods:
getName(): StringgetDensity(): doublegetValue(): doublesetValue(value: double): voidtoString(): String
Container (abstract)
Attributes:
thickness: doubledensity: double
Methods:
getThickness(): doublegetDensity(): doublecalculateWallWeight(): doublecalculateInteriorVolume(): double (abstract)calculateExteriorVolume(): double (abstract)toString(): String
Cylinder (extends Container)
Attributes:
radius: doubleheight: double
Methods:
calculateInteriorVolume(): doublecalculateExteriorVolume(): doubletoString(): String
TrapezoidalBox (extends Container)
Attributes:
upperLength: doublelowerLength: doublewidth: doubleheight: double
Methods:
calculateInteriorVolume(): doublecalculateExteriorVolume(): doubletoString(): String
RollingStock (abstract)
Attributes:
owner: Stringid: intbaseWeight: double
Methods:
getOwner(): StringgetId(): intgetBaseWeight(): doubletoString(): String
Engine (extends RollingStock)
Attributes:
pullingCapacity: double
Methods:
getPullingCapacity(): doubletoString(): String
FreightCar (extends RollingStock)
Attributes:
loadFactor: doublecontainer: Containercontents: Contents
Methods:
getLoadFactor(): doublesetLoadFactor(loadFactor: double): voidcalculateTotalWeight(): doublecalculateTotalValue(): doubletoString(): String
Train
Attributes:
engine: EngineengineerName: StringfreightCars: List
Methods:
addFreightCar(car: FreightCar): voidremoveFreightCar(id: int): voidchangeLoadFactor(id: int, loadFactor: double): voidcalculateTotalWeight(): doublecalculateTotalValue(): doubletoString(): String

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!