forked from CEN4020-Fall/assignment2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBus.cpp
More file actions
42 lines (33 loc) · 776 Bytes
/
Copy pathBus.cpp
File metadata and controls
42 lines (33 loc) · 776 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
//
// Created by Nicholas Tidwell on 10/1/19.
//
#include "Bus.h"
Bus::Bus() {
setBrand("Custom");
setModel("VTx");
setNumberOfStops(1);
}
Bus::Bus(string brand, string model, string fuelType, int numberOfStops) {
setBrand(brand);
setModel(model);
setFuelType(fuelType);
setNumberOfStops(numberOfStops);
}
Bus::~Bus() = default;
int Bus::getNumberOfStops() {
return numberOfStops;
}
void Bus::setNumberOfStops(int numberOfStops) {
this->numberOfStops = numberOfStops;
}
double Bus::mileageEstimate(double time) {
double mileage = 10 * time;
if (numberOfStops < 15){
mileage += mileage * 0.10;
}
return mileage;
}
string Bus::toString() {
return "-> Bus\n" + PoweredVehicle::toString() + "\n\tNumber of Stops " +
std::to_string(getNumberOfStops());
}