Question: Can you make a UML design Parent Class: Train Fields: trainNumber ( string ) : Represents the unique identification number of the train. Methods: startEngine
Can you make a UML design
Parent Class: Train
Fields:
trainNumber string: Represents the unique identification number of the train.
Methods:
startEngine: Starts the train's engine.
stopEngine: Stops the train's engine.
Child Class : PassengerTrain inherits from Train
Fields:
passengerCapacity int: Represents the maximum number of passengers the passenger train can carry.
Methods:
boardPassenger: Allows passengers to board the train.
disembarkPassenger: Allows passengers to disembark from the train.
Child Class : FreightTrain inherits from Train
Fields:
cargoCapacity double: Represents the maximum cargo capacity of the freight train in tons.
Methods:
loadCargo: Loads cargo onto the train.
unloadCargo: Unloads cargo from the train.
Grandchild Class : HighSpeedTrain inherits from PassengerTrain
Fields:
maximumSpeed int: Represents the maximum speed the highspeed passenger train can achieve in kilometers per hour.
Methods:
increaseSpeed: Increases the train's speed.
decreaseSpeed: Decreases the train's speed.
Grandchild Class : CoalTrain inherits from FreightTrain
Fields:
coalType string: Represents the type of coal being transported by the coal train eg anthracite, bituminous
Methods:
burnCoal: Simulates the process of burning coal in a power plan
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
