-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassenger.cpp
More file actions
77 lines (70 loc) · 2.37 KB
/
Passenger.cpp
File metadata and controls
77 lines (70 loc) · 2.37 KB
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
/*
Passenger.cpp
Adetoye Adebayo
24th Septemeber, 2025
CS 15 HW 3 MetroSim
This file implements the Passenger class by storeing its id and
start/end stations,and printing the passenger's travel route for
queues and the train.
*/
#include "Passenger.h"
#include <iostream>
#include <string>
/*
* name: Passenger( )
* purpose: This is the constructor for Passenger that initializes
* a Passenger object with an ID, starting station, and
* ending station.
* arguments: An integer passenger ID, an integer starting station,
* and an integer ending station.
* returns: none
* effects: Constructs a Passenger with the provided information.
* note: Students do not have to modify this function.
*/
Passenger::Passenger(int id, int startingStation, int endingStation) {
this->id = id;
this->startingStation = startingStation;
this->endingStation = endingStation;
}
/*
* name: getId( )
* purpose: This is the getter (aka accessor) function that provides
* access to the Passenger's ID.
* arguments: none
* returns: The Passenger's ID.
* effects: none
* note: Students do not have to modify this function.
*/
int Passenger::getId() { return id; }
/*
* name: getStartingStation( )
* purpose: This is the getter (aka accessor) function that provides
* access to the Passenger's starting station.
* arguments: none
* returns: The Passenger's starting station.
* effects: none
* note: Students do not have to modify this function.
*/
int Passenger::getStartingStation() { return startingStation; }
/*
* name: getEndingStation( )
* purpose: This is the getter (aka accessor) function that provides
* access to the Passenger's ending station.
* arguments: none
* returns: The Passenger's ending station.
* effects: none
* note: Students do not have to modify this function.
*/
int Passenger::getEndingStation() { return endingStation; }
/*
* name: print( )
* purpose: Prints the Passengers Id, starting station, and ending station
* arguments: output - the output stream where the Passenger is printed.
* returns: none
* effects: Writes Passenger info to the given stream.
* note: none
*/
void Passenger::print(std::ostream &output) {
output << "[" << id << ", " << startingStation << "->" <<
endingStation << "]";
}