Train Station Schedule, C/C++ Programming

Assignment Help:
Train Station C++ Program

A C++ program that provides a simple text based interface that will allow a user to create, edit, search, or delete a train schedule.

The program will manage these attributes in an object, which will consist of a single linked list stored in memory. The linked list can be a global variable for simplicity. The program must use the “list” API in the C++ standard template library (STL). The program must implement at least one class that will hold the following variables:

· scheduleId - An integer variable to hold the schedule identifier. This must be a randomly generated 10-digit number. The scheduleId is a unique identifier for each train schedule in the linked list and repeats are not allowed.

· scheduleDate - A string variable to hold the date that the schedule will take effect. The date must be in the form mm/dd/yyyy. Where mm is the two- digit month, dd is the two-digit day, and yyyy is a four-digit year.

· scheduleDays - An integer variable to hold the number of days that the schedule will be valid.

· trainNumber - An integer variable to hold the train number.

· originStation - A string variable to hold the name of the station of origin. Note that spaces must be allowed in the string.

· origDepartureTime - A string variable that will hold the time that the train will depart from the station of origin. This variable must be in the form HHMM, where HH is a number from 00-23 and MM is a number from 00- 59.

· destinationStation - A string variable to hold the name of the destination station. Note that spaces must be allowed in the string.

· arrivalTime - A string variable that will hold the time that the train will arrive that the destination station. This variable should be in the form HHMM.

· departureTime - A string variable that will hold the time that the train will depart from the station. This variable should be in the form HHMM.

Provide the appropriate methods to set and get the data for each of these class variables. For example setScheduleDate(string scheduleDate) and string getScheduleDate().

The main program must provide the following functionality:

1. When the program is first started, it must read a data file called schedule.dat. The program will not prompt the user for the name of the data file. The name of the file must be hard-coded in the program. If the file exists, the program will load the data for each schedule into the global linked list. If the file does not exist, the program will start with an empty linked list.

2. The program will provide a simple text-based user interface that manages the all of the train schedules within a linked list. Each schedule must be placed in the linked list as an object that holds all of the attributes associated with it as mentioned above. The user interface will allow the user to perform the following:

a) EnterSchedule – allows the user to enter all of the fields associated with a given train schedule, except for the scheduleId, which will be automatically generated by the program as previously mentioned. After the fields are entered, the program will place the schedule object in the global linked list.

b) DisplayAllSchedules – displays all of the schedules within the linked list along with their associated fields. In addition, this option must print the total number of schedules in the linked list.

c) SearchforSchedule – allows the user to find a schedule by its schedule identifier. The program will prompt the user to enter the scheduleId and will display all of the fields associated with the given schedule, if it is found. The program must display an error message if the schedule is not found in the linked list.

d) Edit Schedule – allows the user to edit the fields for a given schedule that is in the linked list. The program must prompt the user to enter the scheduleId as the key to find the schedule to edit. For simplicity, the program may re-prompt the user to re-enter all of the fields associated with the schedule; but, it must reuse the scheduleId value.

e) DeleteSchedule – allows the user to delete a schedule from the linked list using the scheduleId as the key.

f) ExitSystem – before the program exits, it must save all of the data in the linked list to the data file. I recommend using a standard text file with one field in the object per line. At this point, if the file does not exist, the program will create it.

Related Discussions:- Train Station Schedule

Calculate the discharge by c program, #include stdio.h #include math.h ...

#include stdio.h #include math.h float discharge(float,float); void main()   {   char prompt;      float time,out,cr;   cr = 100e-6;   for (time = 0;time   {   /* call th

Super ASCII string cost, string will contain only lower case alphabet& the ...

string will contain only lower case alphabet& the ascii value starts from 1-26,(ie,a=1&z=26).it perform the operation like the following costs:add=2units,replace=1unit,delete=3unit

Prime no., program to find if a no . is prime or not

program to find if a no . is prime or not

Loops, how to make a diamond from steric

how to make a diamond from steric

Develop a windows application to show computer hardware, - But with less fe...

- But with less features and more user-friendly (particularly for non-tech savvy users). - Software needed having a left menu with links (no pictures required) for every hardwar

C++, Write a program to find the area under the curve y = f(x) between x = ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

C program for find even & odd no.s in the array , C Program for FIND EVEN &...

C Program for FIND EVEN & ODD NO.S IN THE ARRAY #include stdio.h> #include string.h> #include conio.h> void main() {           int i=0,j=0, l_e[100],l_o[100];

Program for design and simulate a basic risc processor, Overall Program Obj...

Overall Program Objective: You will design and simulate a basic RISC processor.   You will create and encode an instruction set.  Your final task will be to "compile" a program

Pattern, enter height of the shape: 1 3 5 3 1 3 5 7 5 3 5 7 9 7 5 3 5 7...

enter height of the shape: 1 3 5 3 1 3 5 7 5 3 5 7 9 7 5 3 5 7 5 3 1 3 5 3 1

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