forked from CEN4020-Fall/assignment2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJet.cpp
More file actions
43 lines (34 loc) · 851 Bytes
/
Copy pathJet.cpp
File metadata and controls
43 lines (34 loc) · 851 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
//
// Created by Nicholas Tidwell on 9/20/19.
//
#include "Jet.h"
Jet::Jet() {
numberOfEngines = 1;
setBrand("");
setModel("");
}
Jet::Jet(string brand, string model, string fuelType, int numberOfEngines) {
setBrand(brand);
setModel(model);
setFuelType(fuelType);
setNumberOfEngines(numberOfEngines);
}
Jet::~Jet() = default;
int Jet::getNumberOfEngines() {
return numberOfEngines;
}
void Jet::setNumberOfEngines(int numberOfEngines) {
numberOfEngines = numberOfEngines;
}
double Jet::mileageEstimate(double time) {
double random = rand() % 100 + 40;
double mileage = random * time;
if (fuelType == "Rocket" && numberOfEngines > 2) {
mileage += mileage * 0.055;
}
return mileage;
}
string Jet::toString() {
return "-> Jet\n" + PoweredVehicle::toString() + "\n\tNumber of Engines: " +
std::to_string(getNumberOfEngines());
}