forked from CEN4020-Fall/assignment2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonorail.cpp
More file actions
45 lines (37 loc) · 816 Bytes
/
Copy pathMonorail.cpp
File metadata and controls
45 lines (37 loc) · 816 Bytes
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
//Created by Nicholas Watts on Oct 4, 2019
#include "Monorail.h"
Monorail::Monorail()
{
numberCylinders = 0;
setBrand("Unknown");
setModel("Unknown");
}
Monorail::Monorail(string brand, string model, int numCyl)
{
setBrand(brand);
setModel(model);
setNumberCyl(numCyl);
}
Monorail::~Monorail() = default;
int Monorail::getNumberCyl()
{
return numberCylinders;
}
void Monorail::setNumberCyl(int newNum)
{
if (newNum > 0)
numberCylinders = newNum;
}
double Monorail::mileageEstimate(double p_time)
{
srand(time(NULL));
double mileage = rand()%20 + 35;
if(getModel() == "aboveGround")
mileage += mileage * 0.002 * numberCylinders;
return mileage;
}
string Monorail::toString()
{
return "-> Monorail\n" + PoweredVehicle::toString() + "\n\tNumber of Cylinders: " +
to_string(getNumberCyl());
}