Stuck with my functions and output

Hello,
I've written most of my functions that I think I need for this problem, but can't figure out what I need to write for my last functions and output.

The Problem:
The input file (airline.txt) has the following layout:

Price (the cost of the ticket for that particular trip, it should be doubled if it is one way)
Airport 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, including the airport tax, such as 6%, 10%, …etc.)
Airline name (SP, NW, SW, AA)
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:

99.99 10.00 0.06 SP Detroit 1 Palm Beach
143.95 13.00 0.06 NW Detroit 1 Palm Beach
99.00 10.00 0.10 SP Las Vegas 2 Detroit

You need to write a program 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 airline from the input and then expand them to the full name in the output. For example, NW, will become Northwest Airline, and SP will print Spirit Airline. 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 SP Detroit 1 Palm Beach is:

The round trip price from DT to PB using Spirit Airline is $222.58

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

enum airlineType {NONE=0, SP, NW, SW, AA}; 
char* airlines[] = {"NONE", "Spirit Airlines", "Northwest Airlines", "Southwest Airlines", "American Airlines"}; 

airlineType convertString(string str)
{
  if (str == "SP") 
    return SP; 
  if (str == "NW")
    return NW;
  if (str == "SW")
    return SW;
  if (str == "AA")
    return AA;

  return NONE; // if you reach here, then nothing matched, so you default to NONE
}

void display(airlineType air)
{
	switch(air)
	{
	case SP: cout << "Spirit Airlines " << endl; break;
	case NW: cout << "Northwest Airlines " << endl; break;
	case SW: cout << "Southwest Airlines " << endl; break;
	case AA: cout << "American Airlines " << endl; break;
	
	default: cout << "Invalid Airline " << endl; break;
	}
}

int getCity(string line, string& city)
{
	string::size_type pos;
	pos = line.find(" ");  //find the first space
	city = line.substr(0, pos);  //will give me first part of the city name
	if (line.at(pos + 1) >= '0' && line.at(pos + 1) <= '9')  //will check the letter after the space...letter or number
		cout << "My city is " << city << endl;
	else
	{
		pos = line.find(" ", pos + 1);  //find the second space in the city name
		city = line.substr(0, pos);  //gets both words
		cout << "My city is " << city << endl;
	}
	return city.length();
}

int getNumber(string line, float& number)

char getAirline()

char getTrip()

int main()
{
	string line;
	getline(fin, line);

	int length;
	float price;
	length = getNumber(line, price);
	line = line.substr(length);
	float airportTax;
	length = getNumber(line, airportTax);
	line = line.substr(length);
	float salesTax;
	length = getNumber(line, salesTax);
	line = line.substr(length);
	airlineType airline;
	length = getAirline(line, airline);
	line = line.substr(length);

	return 0;

}
Topic archived. No new replies allowed.