Question: You will have to write four methods about trains. The user will input information about a train like: How many cars are in the train

You will have to write four methods about trains. The user will input information about a train like:

How many cars are in the train (int)?

What cargo is the train carrying (only 1 cargo per train). This should be a string. Coal, oil, propane

Distance to Newport News (int)

Speed of train (int)

These inputs should be part of the main.

Functions

PrintTrain(a,b,c,d) takes three parameters and prints the following information.

A train ________miles from Newport News with _____cars carrying _________is moving at _______mph and should arrive in __________minutes.

CalculateWeight method takes two parameters and returns total freight carried by the train.

Coal weighs 3000 kg/car; oil 200 kg/car; propane 4000 g/car. Any other type of freight should return Cant be determined.

ArrivalTime method takes the distance parameter and speed parameter to return how long before the train arrives in Newport News. minutes=mph*60 min*miles to NN

Python

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 Databases Questions!