Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

Train Station C++ Program

Create a C++ program will provide 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. Input Validation Required: The program must re-prompt the user to re-enter the date if it is not the valid format provided above.

• scheduleDays -An integer variable to hold the number of days that the schedule will be valid.
Input Validation Required: The program must re-prompt the user to re-enter the number if it is not greater than 0.

• 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. Input validation is recommended but is not required. 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. Again, input validation is recommended but not required here. 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.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92373946
  • Price:- $70

Priced at Now at $70, Verified Solution

Have any Question?


Related Questions in C/C++

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As