Program simulate a metropolitan subway train, C/C++ Programming

Assignment Help:

You're going to simulate a metropolitan subway train.  The train system will start out at Station #1, or Home  Station, and will service multiple stations along its route.

2114_Program Simulate A Metropolitan Subway Train.png

SPECIFIC DIRECTIONS

EVERYTHING MUST BE DONE IN THE HEADER FILE, ONLY USE THE .CPP TO CALL THE FUNCTIONS!  ANY CODE IN THE .CPP FILE WILL RESULT IN A 0!

We have developed (or will develop) many of the basics for the class SubwayTrain in the classroom.  (For online students, I will post this class definition at an appropriate time.)  The train will run around a closed loop of rail, serving a number of stations that you will specify when you declare (instantiate) the object. It will be electric, so we don't ever have to worry about refueling it.  And it will always run in the same direction.

The train will carry a certain number of passengers from station to station, dropping off and picking up randomly-generated numbers of passengers at each station.  Generating those numbers will be part of your class-more on that later.

Once I post the class handout, you can start by building on that.  Or feel free to develop your own.  But you need to check the handout for the minimum specification. I will expect you to use all the instance variables and methods in the handout, at least as far as their purpose. If you rename them, that's fine, but the handout will contain the minimum instance variables and methods that must be implemented.   [One possible exception:  see later.]  The constructor needs to accept at least two values:  the number of stations on the complete route; and the maximum capacity of the train. The reason is so that you can simulate different sizes of systems and different sizes of trains.

When the simulation begins, generate a random number of passengers to board at Home Station (Station #1).  Then, run the train all around its system, serving every stop along the way, and finish back at Home Station. When departing each station, you must announce, at a minimum, the station you are leaving, the destination station, and the number of passengers on board.  When the train "arrives" at any station, it needs to announce how many passengers are departing and how many are boarding.  Both of these numbers will be randomly-generated, but the number of passengers you allow to board, for example, cannot end up exceeding the maximum capacity of the train.

Note on the random numbers.  It will not be acceptable if you restrict the size of your random numbers to values so low that the conductor never has to worry about the number wanting to board.  For example, if you have a capacity of 200, and you restrict your loading passenger number to 10, say, then certainly you will never have to worry about overloading!  That is not acceptable, since you then won't need any checks on any of these values in your loading method. Your class logic must ensure that the train is never overloaded, or that more passengers try to leave the train than are on board. Once in a while, your program should announce that too many people are trying to board, and only the allowable number will really be let on.  Just like real life, the rest will be left at the station (fuming!).

For this program, I want you to "build" a subway train that has a maximum capacity of 200 passengers and that has a total station count of 30 stations.  (Remember that Home Station is Station #1.)

For each stop you need to generate a random number between Ø and the number of pax already onboard, and that number of people will depart the train at this stop.  Then, generate another random number of pax to get on board the train. This random number of passengers waiting to board must be between 0 - 300.

For now, we won't worry about details such as how the customers will pay.  We'll save that problem for another day.

One final note:  since we have not discussed in depth how class methods can call each other, I am not making that a mandatory part of this program.  It will be worth extra credit.  If you want to use main to run the train around the route, that is OK.  In other words, if you call all of the appropriate methods from main, then you will probably not have a single runTheRoute method that is referenced in the handout for the class.  Just be sure that the class can take care of itself if you "run the train" from main.  For example, checking for how many passengers that can board must surely be done inside an appropriate method.

The name of your solution should be this:  Program4 Solution name, where name is your last name.

Call only two public methods from main: the constructor and a method to start the train rolling. The runTheRoute method in the handout was intended for just that purpose: to run the train completely around the system one time. This means that the train object will be a completely self-contained simulation.


Related Discussions:- Program simulate a metropolitan subway train

Last fibonnaci standing, i need a program for finding the last fibonacci nu...

i need a program for finding the last fibonacci number

Creates and implements a class to represent the queue, Purpose This ass...

Purpose This assignment is an exercise in implementing the queue ADT using a singly-linked list. This assignment also introduces the concept of templates. Assignment Th

Area under curve., write a c progrm to find area under the cuve y=f(x)  ...

write a c progrm to find area under the cuve y=f(x)   #include float start_point, /* GLOBAL VARIABLES */ end_point, total_area; in

HASH., Define hash functions. Explain the Division method, Mid square metho...

Define hash functions. Explain the Division method, Mid square method and Folding method of hash functions.

Assignmet, I have a assignment deadline is 11.11.2015 can I get help

I have a assignment deadline is 11.11.2015 can I get help

Luminous jewel polishing neckiace, Byteland county is very famous for lumin...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Program to calculate pie, This problem familiarizes you with using random n...

This problem familiarizes you with using random numbers in C++. The program is to compute a good approximation of p using a simulation method called "Monte Carlo". The following fi

What are the benefits of using friend classes, What are the benefits of usi...

What are the benefits of using friend classes? - Friend classes are useful when a class wants to hide features from users which are required only by another, tightly coupled cl

Oop, what is oop?

what is oop?

I want im messenger, I would like to get you to collaborate in my project. ...

I would like to get you to collaborate in my project. We want a C programmer to Develop applications for Windows, the first application may be an Instant messenger encrypted in a w

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd