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 1: 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 2: 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 1: HighSpeedTrain (inherits from PassengerTrain)
Fields:
maximumSpeed (int): Represents the maximum speed the high-speed passenger train can achieve in kilometers per hour.
Methods:
increaseSpeed(): Increases the train's speed.
decreaseSpeed(): Decreases the train's speed.
Grandchild Class 2: CoalTrain (inherits from FreightTrain)
Fields:
coalType (string): Represents the type of coal being transported by the coal train (e.g., 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 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!