Hello...I am a beginner with C++ programming and am trying to self teach myself enums and strings. I am doing a tutorial problem out of book someone gave me and can't even figure out how to start it.
If anyone can help, it would be greatly appreciate it.
Calculate and print the total cost of a round trip ticket for each line in the data file.
The input file (travel.txt) has the following layout:
Price (the cost of the ticket for that particular trip, it should be doubled if it is one way)
Travel tax (the tax for whole trip, both round trip and one way pay that tax)
Sales tax (the percentage tax on the total price of the ticket, as 6%, 10%, …etc.)
Train or Bus name (GH, AT)
Origin City (can be one or two words)
One-way/roundtrip (1 means one way, 2 means round trip)
Destination City (can be one or two words)
These are examples of some trips:
//first line is price, then tax, then sales tax, GH name of busline, then city, 1 one way – 2 round trip, then destination.
99.99 10.00 0.06 GH Charleston 1 Daytona Beach
143.95 13.00 0.06 AT Chicago 2 New York
The program has to read the file one record at a time, then print the itinerary for that trip and calculate the ticket price as a round trip ticket (even if it was given as a one-way trip in the file.) The program will read the code letters for the name of the form of travel from the input and then expand them to the full name in the output. For example, GH, will become Greyhound Busline, and AT will print AmTrack. The program also will read the name of the city from the input, then it will abbreviate it. If the city is one word, then the abbreviation will be the first and last letters of the word. Both letters should be capitalized. If the city is two words, then the abbreviation will be the first letter of each word.
A sample output for 99.99 10.00 0.06 GH Charleston 1 Daytona Beach is:
The round trip price from CN to DB using Greyhound Busline is $222.58