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
37 lines (31 loc) · 746 Bytes
/
Copy pathJet.cpp
File metadata and controls
37 lines (31 loc) · 746 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
#include "Jet.h"
#include <cstdlib>
#include <ctime>
#include <string>
Jet::Jet() {
setBrand("unknown");
setModel("unkown");
setNumberOfEngines(1);
}
Jet::Jet(string brand, string model, string fuelType, int numberOfEngines) {
setBrand(brand);
setModel(model);
setFuelType(fuelType);
}
Jet::~Jet() = default;
double Jet::mileageEstimate(double time) {
srand((unsigned)time(0));
int mileage;
mileage = (rand() % 60) + 41;
if (fuelType == "Rocket" && numberOfEngines >= 2) {
double i = (numberOfEngines * 0.055) + 1;
mileage = mileage * i * time;
}
return mileage;
}
string Jet::toString() {
return "-> Jet\n" + PoweredVehicle::toString();
}
void Jet::setNumberOfEngines(int engineCount){
numberOfEngines = engineCount;
}