-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlane.cpp
113 lines (87 loc) · 2.07 KB
/
Plane.cpp
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
* John Sadiq
* CS 281 Fall 2019
* Airport Project
*
* Plane.cpp
*
*
*
*/
#include "Plane.h"
using namespace std;
// Contructor for Plane
Plane:: Plane() {}
//Constructor sets Plane: name, fuel, and type. Using a switch to pick which plane is needed at the time.
Plane::Plane(string pname, int pfuel, planeType ptype, int ppriority, string pstatus) {
name = pname;
fuel = pfuel;
type = ptype;
priority = ppriority;
status = pstatus;
}
//Destructor for Plane
Plane:: ~Plane() {}
//Getters
//get Plane Name
string Plane::getName()
{
return name;
}
//get Plane Fuel
int Plane::getFuel()
{
return fuel;
}
//get Plane Priority
int Plane::getpriority()
{
return priority;
}
//get Plane Status
string Plane::getStatus()
{
return status;
}
//get Plane Type
planeType Plane::getplanetype()
{
return type;
}
//get info for display, This is for when the user asks for the status of all the planes
//grabs info per plane and displays when user prompts and displays them appropiately and with even space
string Plane::getInfo()
{
string converstionTypes[3] = { "Commmercial", "Private", "Air_Force_1" };
ostringstream outputStream;
outputStream <<"Name: " << std::setw(10) << name << " | fuel: " << std::setw(4) << fuel <<
"%" << " | Priority: " << std::setw(3) << priority << " | Plane type: " << std::setw(15) <<
converstionTypes[type] << " | Status: " << std::setw(10) << status;
return outputStream.str();
}
//Setters
//set Plane Name
void Plane::setName(string planeName)
{
name = planeName;
}
//set Fuel, fuel for a new plane will be a random number between 10% - 90%
void Plane::changeFuel(int pfuel)
{
fuel += pfuel;
}
//set Plane Priority
void Plane::setPriority(int ppriority)
{
priority = ppriority;
}
//Set Plane Status
void Plane::setStatus(string pstatus)
{
status = pstatus;
}
//Set Plane Type
void Plane::setPlanetype(planeType pplaneType)
{
type = pplaneType;
}