From ba37422409770422c9a9d735c931420c6d2e971c Mon Sep 17 00:00:00 2001 From: kdavis0221 <51808027+kdavis0221@users.noreply.github.com> Date: Mon, 30 Sep 2019 14:27:12 -0400 Subject: [PATCH 01/10] Update README.md README was updated to include owner info --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e69de29b..3d781ab9 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,2 @@ +Name: Kristen Davis +FSUID: knd15e From 42d4df1f6effbfe5e9b60b8b99f5e394c145d3dc Mon Sep 17 00:00:00 2001 From: kdavis0221 <51808027+kdavis0221@users.noreply.github.com> Date: Mon, 30 Sep 2019 20:19:12 -0400 Subject: [PATCH 02/10] adding docs --- docs/answers.txt | 0 docs/status.txt | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 docs/answers.txt create mode 100644 docs/status.txt diff --git a/docs/answers.txt b/docs/answers.txt new file mode 100644 index 00000000..e69de29b diff --git a/docs/status.txt b/docs/status.txt new file mode 100644 index 00000000..1498befe --- /dev/null +++ b/docs/status.txt @@ -0,0 +1,3 @@ +On branch master +Your branch is up to date with 'origin/master'. + From 0103c2871bb82e2780815c2ff3aaf25717f28797 Mon Sep 17 00:00:00 2001 From: kdavis0221 <51808027+kdavis0221@users.noreply.github.com> Date: Tue, 1 Oct 2019 18:20:18 -0400 Subject: [PATCH 03/10] Update answers.txt --- docs/answers.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/answers.txt b/docs/answers.txt index e69de29b..28dd79a9 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -0,0 +1,23 @@ +e.a) On branch master +Your branch is up to date with 'origin/master'. + +e.b) git rev-list --all --count +8 + +e.c) + +e.d) + +e.e) + +e.f) + +e.g) + +e.h) + +e.i) + +e.j) + + From 28b88b265f60feea3afea63cf6b63c3e631f2941 Mon Sep 17 00:00:00 2001 From: kdavis0221 <51808027+kdavis0221@users.noreply.github.com> Date: Tue, 1 Oct 2019 18:50:37 -0400 Subject: [PATCH 04/10] adding the Jet --- Jet.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Jet.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 Jet.cpp create mode 100644 Jet.h diff --git a/Jet.cpp b/Jet.cpp new file mode 100644 index 00000000..a84e5463 --- /dev/null +++ b/Jet.cpp @@ -0,0 +1,54 @@ +// +// Created by Esteban Parra on 9/5/19. +// + +#include "Jet.h" + +Jet::Jet() { + myEngineSize = "unknown"; + setBrand("Custom"); + setModel("VTx"); + setNumberofEngines(1); +} + +Jet::Jet(string brand, string model, string fuelType, string engineSize, int numberOfEngines=1) { + setBrand(brand); + setModel(model); + setFuelType(fuelType); + setEngineSize(engineSize); + setNumberofEngines(numberOfEngines) +} + +Jet::~Jet() = default; + +string Jet::getEngineSize() { + return myEngineSize; +} + +void Jet::setEngineSize(string engineSize) { + if (engineSize == "unknown" || engineSize == "small" || + engineSize == "medium" || engineSize == "grande") { + myEngineSize = engineSize; + } else { + myEngineSize = "unknown"; + } + +} + +double Jet::mileageEstimate(double time) { + double mileage = 15 * time; + if (fuelType == "electricity") { + mileage += mileage * 0.05; + } + return mileage; +} + +string Jet::toString() { + return "-> Jet\n" + PoweredVehicle::toString() + "\n\tEngine Size: " + + getEngineSize(); + +void Jet::setNumberofEngines(int ne) +{ + numEngines=ne; +} +} diff --git a/Jet.h b/Jet.h new file mode 100644 index 00000000..3ff73126 --- /dev/null +++ b/Jet.h @@ -0,0 +1,31 @@ +// +// Created by Esteban Parra on 9/5/19. +// + +#ifndef DRIVINGSIMULATOR_CAR_H +#define DRIVINGSIMULATOR_CAR_H + +#include "PoweredVehicle.h" + +class Jet : public PoweredVehicle { + +private: + string myEngineSize; + int numEngines; + +public: + Jet(); + + explicit Jet(string brand, string model, string fuelType, + string engineSize, int numberOfEngines); + + virtual ~Jet(); + string getEngineSize(); + void setEngineSize(string engineSize); + virtual double mileageEstimate(double time); + virtual string toString(); + void setNumberofEngines(int ne); +}; + + +#endif //DRIVINGSIMULATOR_CAR_H From 56e7326460f17c557699ccefeb691864066e4773 Mon Sep 17 00:00:00 2001 From: kdavis0221 <51808027+kdavis0221@users.noreply.github.com> Date: Tue, 1 Oct 2019 20:05:03 -0400 Subject: [PATCH 05/10] Update Jet.cpp worked on Mileage --- Jet.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Jet.cpp b/Jet.cpp index a84e5463..6bd1c142 100644 --- a/Jet.cpp +++ b/Jet.cpp @@ -1,7 +1,8 @@ // // Created by Esteban Parra on 9/5/19. // - +#include +#include #include "Jet.h" Jet::Jet() { @@ -36,9 +37,9 @@ void Jet::setEngineSize(string engineSize) { } double Jet::mileageEstimate(double time) { - double mileage = 15 * time; - if (fuelType == "electricity") { - mileage += mileage * 0.05; + double mileage = (rand()%(100-40)+40) * time; + if (fuelType == "rocket" && numberOfEngines>=2) { + mileage += mileage * (0.055); } return mileage; } From 8f675a6056f94ac07c1a41aac793c04cef89c063 Mon Sep 17 00:00:00 2001 From: kdavis0221 <51808027+kdavis0221@users.noreply.github.com> Date: Thu, 3 Oct 2019 18:12:32 -0400 Subject: [PATCH 06/10] worked on vehicles --- Bicycle.h | 6 +++--- Jet.cpp | 2 +- Jet.h | 4 ++-- Skateboard.cpp | 39 +++++++++++++++++++++++++++++++++ Skateboard.h | 27 +++++++++++++++++++++++ docs/answers.txt | 12 ++++++----- tank.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ tank.h | 31 +++++++++++++++++++++++++++ 8 files changed, 166 insertions(+), 11 deletions(-) create mode 100644 Skateboard.cpp create mode 100644 Skateboard.h create mode 100644 tank.cpp create mode 100644 tank.h diff --git a/Bicycle.h b/Bicycle.h index 61b7ca3d..46cd7380 100644 --- a/Bicycle.h +++ b/Bicycle.h @@ -1,5 +1,5 @@ // -// Created by Esteban Parra on 9/5/19. +// Created by Kristen Davis // #ifndef DRIVINGSIMULATOR_BICYCLE_H @@ -10,14 +10,14 @@ class Bicycle : public Vehicle { private: - int myGearCount; + int numberofwheels; public: explicit Bicycle(string brand, string model, int gearCount = 1); virtual ~Bicycle(); int getGearCount(); - void setGearCount(int gearCount); + void setGearlCount(int gearCount); virtual double mileageEstimate(double time); virtual string toString(); diff --git a/Jet.cpp b/Jet.cpp index 6bd1c142..6c30ec57 100644 --- a/Jet.cpp +++ b/Jet.cpp @@ -1,5 +1,5 @@ // -// Created by Esteban Parra on 9/5/19. +//Kristen Davis // #include #include diff --git a/Jet.h b/Jet.h index 3ff73126..c7d2b33b 100644 --- a/Jet.h +++ b/Jet.h @@ -2,8 +2,8 @@ // Created by Esteban Parra on 9/5/19. // -#ifndef DRIVINGSIMULATOR_CAR_H -#define DRIVINGSIMULATOR_CAR_H +#ifndef DRIVINGSIMULATOR_JET_H +#define DRIVINGSIMULATOR_JET_H #include "PoweredVehicle.h" diff --git a/Skateboard.cpp b/Skateboard.cpp new file mode 100644 index 00000000..3b75b7e7 --- /dev/null +++ b/Skateboard.cpp @@ -0,0 +1,39 @@ +// +//Kristen Davis +// +#include +#include +#include "Skateboard.h" + + +Skateboard::Skateboard(string brand, string model, int numberofwheels) { + setBrand(brand); + setModel(model); + setGearCount(numberofwheels); +} + +Skateboard::~Skateboard() = default; + +int Skateboard::getWheelCount() { + return numberofwheels; +} + +void Skateboard::setWheelCount(int num) { + numberofwheels = num; +} + +double Skateboard::mileageEstimate(double time) { + double mileage = (rand()%(.5-.1 +1)+.1) * time; + if(time>=25 && time<250) + { + double high= time/3; + mileage+=(rand()%(high-1)+1); + } + return mileage; +} + +string Skateboard::toString() { + string s = "-> Skateboard\n\t"; + return "-> Skateboard\n" + Vehicle::toString() + "\nWheels: " + + to_string(numberofwheels); +} diff --git a/Skateboard.h b/Skateboard.h new file mode 100644 index 00000000..35795928 --- /dev/null +++ b/Skateboard.h @@ -0,0 +1,27 @@ +// +// Created by Kristen Davis +// + +#ifndef DRIVINGSIMULATOR_SKATEBOARD_H +#define DRIVINGSIMULATOR_SKATEBOARD_H + +#include "Vehicle.h" + +class Skateboard : public Vehicle { + +private: + int numberofwheels; + +public: + explicit Skateboard(string brand, string model, int numberofwheels = 4); + + virtual ~Skateboard(); + int getWheelCount(); + void setWheelCount(int numberofwheels); + virtual double mileageEstimate(double time); + + virtual string toString(); +}; + + +#endif //DRIVINGSIMULATOR_BICYCLE_H diff --git a/docs/answers.txt b/docs/answers.txt index 28dd79a9..4967f5c1 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -4,20 +4,22 @@ Your branch is up to date with 'origin/master'. e.b) git rev-list --all --count 8 -e.c) +e.c) git log --follow .gitignore +Date: Wed Sep 25 18:13:30 2019 -0400 e.d) e.e) -e.f) +e.f) git log -p Vehicle.h -e.g) +e.g) git log --all --grep='file' e.h) -e.i) +e.i) Integration workflows users have public and private branches to work from. + +e.j) It allows for only one person to push to the master instead of multiple small developers pushing to the master and causing issues. -e.j) diff --git a/tank.cpp b/tank.cpp new file mode 100644 index 00000000..a61d1a50 --- /dev/null +++ b/tank.cpp @@ -0,0 +1,56 @@ +// +//Kristen Davis +// +#include +#include +#include "Tank.h" + +Tank::Tank() { + nickname="Company X" + setMisson("Training"); + camoflauge="desert"; + setnumberofGuns(2); +} + +Tank::Tank(string camo, string n,string m, int num) { + camoflauge=camo; + setMisson(m); + nickname=n; + setNumberofGuns(num); +} + +Tank::~Tank() = default; + +void Tank::getnumberofGuns() { + return numberofGuns; +} + +void Tank::setMisson(string m); +{ + misson=m; +} +double Tank::mileageEstimate(double time) { + double mileage=0; + if(misson=="training") + { + mileage=(rand()%(25-10 +1)+10)*time; + } + else if(misson=="desert") + { + mileage=(rand()%(45-10 +1)+10)*time; + } + else + { + mileage=(rand()%(55-10 +1)+10)*time; + } + return mileage; +} + +string Tank::toString() { + return "-> Tank\n" + PoweredVehicle::toString() + "\n Number of Guns: " + + to_string(numberofGuns); + +void Tank::setNumberofGuns(int ne) +{ + numberofGuns=ne; +} diff --git a/tank.h b/tank.h new file mode 100644 index 00000000..40d429ed --- /dev/null +++ b/tank.h @@ -0,0 +1,31 @@ +// +// Created by Esteban Parra on 9/5/19. +// + +#ifndef DRIVINGSIMULATOR_TANK_H +#define DRIVINGSIMULATOR_TANK_H + +#include "PoweredVehicle.h" + +class Tank : public PoweredVehicle { + +private: + string nickname; + int numberofGuns; + string camoflauge; + string misson; + +public: + Jet(); + + explicit Jet(string camo, string nickname,string misson, int numberofGuns); + virtual ~Jet(); + void getnumberofGuns(); + Void setnumberofGuns(int m); + void setMission(string m); + virtual double mileageEstimate(double time); + virtual string toString(); +}; + + +#endif //DRIVINGSIMULATOR_CAR_H From 7abe87f5880463a2d8d9b3be057a7132acc098ab Mon Sep 17 00:00:00 2001 From: kdavis0221 <51808027+kdavis0221@users.noreply.github.com> Date: Thu, 3 Oct 2019 18:54:05 -0400 Subject: [PATCH 07/10] working on veichles --- Jet.cpp | 18 +++++++----------- Jet.h | 6 +++--- main.cpp | 11 ++++++++--- tank.cpp | 2 +- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Jet.cpp b/Jet.cpp index 6c30ec57..d4503d92 100644 --- a/Jet.cpp +++ b/Jet.cpp @@ -12,26 +12,22 @@ Jet::Jet() { setNumberofEngines(1); } -Jet::Jet(string brand, string model, string fuelType, string engineSize, int numberOfEngines=1) { +Jet::Jet(string brand, string model, string fuelType, int numberOfEngines=1) { setBrand(brand); setModel(model); setFuelType(fuelType); - setEngineSize(engineSize); + //setEngineSize(engineSize); setNumberofEngines(numberOfEngines) } Jet::~Jet() = default; -string Jet::getEngineSize() { - return myEngineSize; +string Jet::getNumberofEngines() { + return numberOfEngines; } -void Jet::setEngineSize(string engineSize) { - if (engineSize == "unknown" || engineSize == "small" || - engineSize == "medium" || engineSize == "grande") { - myEngineSize = engineSize; - } else { - myEngineSize = "unknown"; +void Jet::setFuelType(string fuelType) { + fuel=fuelType } } @@ -46,7 +42,7 @@ double Jet::mileageEstimate(double time) { string Jet::toString() { return "-> Jet\n" + PoweredVehicle::toString() + "\n\tEngine Size: " + - getEngineSize(); + getNumberofEngines(); void Jet::setNumberofEngines(int ne) { diff --git a/Jet.h b/Jet.h index c7d2b33b..e518ed85 100644 --- a/Jet.h +++ b/Jet.h @@ -10,7 +10,7 @@ class Jet : public PoweredVehicle { private: - string myEngineSize; + string fuel; int numEngines; public: @@ -20,8 +20,8 @@ class Jet : public PoweredVehicle { string engineSize, int numberOfEngines); virtual ~Jet(); - string getEngineSize(); - void setEngineSize(string engineSize); + string getNumberofEngines(); + void setFuelType(string engineSize); virtual double mileageEstimate(double time); virtual string toString(); void setNumberofEngines(int ne); diff --git a/main.cpp b/main.cpp index ba0b6928..1071e0ca 100644 --- a/main.cpp +++ b/main.cpp @@ -1,12 +1,15 @@ #include #include "Car.h" #include "Bicycle.h" +#include "Skateboard.h" +#include "Jet.h" +#include "Tank.h" void printVehiclesRoster(Vehicle **vehicles, int size); int main() { std::cout << "Driving simulator" << std::endl; - int size = 6; + int size = 9; int capacity = 10; Vehicle **vehiclesArray = new Vehicle *[capacity]; @@ -16,7 +19,9 @@ int main() { vehiclesArray[3] = new Car("Tesla", "T2", "electricity", "large"); vehiclesArray[4] = new Bicycle("Mizuno", "Wave", 10); vehiclesArray[5] = new Car("BMW", "X5", "diesel", "grande"); - + vehiclesArray[6]= new Skateboard("Longboard","Polar",4); + vehiclesArray[7]= new Jet("Boeing","Airbus A350","rocket",4); + vehiclesArray[8]= new Tank("forest", "SoulEater","training"); printVehiclesRoster(vehiclesArray, size); if (vehiclesArray != 0) { // If it is not a null pointer @@ -37,4 +42,4 @@ void printVehiclesRoster(Vehicle **vehicles, int size) { << vehicles[i]->mileageEstimate(simulatedDistance) << " miles in " << simulatedDistance << " seconds" << endl; } -} \ No newline at end of file +} diff --git a/tank.cpp b/tank.cpp index a61d1a50..deea0555 100644 --- a/tank.cpp +++ b/tank.cpp @@ -12,7 +12,7 @@ Tank::Tank() { setnumberofGuns(2); } -Tank::Tank(string camo, string n,string m, int num) { +Tank::Tank(string camo, string n,string m, int num=2) { camoflauge=camo; setMisson(m); nickname=n; From 7689b4868a4b8e60631e069a3a49deabdcb0017a Mon Sep 17 00:00:00 2001 From: kdavis0221 <51808027+kdavis0221@users.noreply.github.com> Date: Thu, 3 Oct 2019 19:17:20 -0400 Subject: [PATCH 08/10] Update answers.txt --- docs/answers.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/answers.txt b/docs/answers.txt index 4967f5c1..e899b1ed 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -23,3 +23,6 @@ e.j) It allows for only one person to push to the master instead of multiple sma +5) +The Driving simulator prototype uses polymorphism since it sets the brand and model of a vehicle regardless of its a powered vehicle or an unpowerd vehicle. +The Driving simulator prototype uses encapsulation since all the different aspects of the vehicle are in the private data section. From e0fb530cdd8d514f8e420712cd0d18310c6c0a2d Mon Sep 17 00:00:00 2001 From: kdavis0221 <51808027+kdavis0221@users.noreply.github.com> Date: Thu, 3 Oct 2019 20:23:45 -0400 Subject: [PATCH 09/10] Update answers.txt --- docs/answers.txt | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/answers.txt b/docs/answers.txt index e899b1ed..764e4b73 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -7,22 +7,31 @@ e.b) git rev-list --all --count e.c) git log --follow .gitignore Date: Wed Sep 25 18:13:30 2019 -0400 -e.d) -e.e) +e.d) 1)allowing people to review changes + 2)allow's bugs to be fixed when software is live and the fix can be implemented during the next update when the branch is merged with the master. + +e.e) Git status shows the state of the working directory and what changes have been staged and not tracked. Git Log allows you to view information about previous commits that have occurred in the project. e.f) git log -p Vehicle.h e.g) git log --all --grep='file' -e.h) +e.h) Inheritance is a mechanism where you can to derive a class from a family of classes that share attributes. + Polymorphism is a programming language's ability to process objects depending on data type. + Encapsulation is the bundling of data and functions that work on the data in one class. -e.i) Integration workflows users have public and private branches to work from. +e.i) Integration workflows users have public and private +branches to work from. -e.j) It allows for only one person to push to the master instead of multiple small developers pushing to the master and causing issues. +e.j) It allows for only one person to push to the master +instead of multiple small developers pushing to the master and +causing issues. -5) -The Driving simulator prototype uses polymorphism since it sets the brand and model of a vehicle regardless of its a powered vehicle or an unpowerd vehicle. -The Driving simulator prototype uses encapsulation since all the different aspects of the vehicle are in the private data section. +5) The Driving simulator prototype uses polymorphism since it +sets the brand and model of a vehicle regardless of its a +powered vehicle or an unpowerd vehicle. The Driving simulator +prototype uses encapsulation since all the different aspects +of the vehicle are in the private data section. From d4ca4bc7f266c07478a0f145e1c87eed6b505b3b Mon Sep 17 00:00:00 2001 From: kdavis0221 <51808027+kdavis0221@users.noreply.github.com> Date: Fri, 4 Oct 2019 18:53:51 -0400 Subject: [PATCH 10/10] finishing assignment --- Skateboard.cpp | 8 +++++--- docs/answers.txt | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Skateboard.cpp b/Skateboard.cpp index 3b75b7e7..aa9e3514 100644 --- a/Skateboard.cpp +++ b/Skateboard.cpp @@ -1,8 +1,7 @@ // //Kristen Davis // -#include -#include +#include #include "Skateboard.h" @@ -23,7 +22,10 @@ void Skateboard::setWheelCount(int num) { } double Skateboard::mileageEstimate(double time) { - double mileage = (rand()%(.5-.1 +1)+.1) * time; + random_device rd; + mt19937 en(rd()); + uniform_double_distribution<> distro(.1,.5); + double mileage = distro(en) * time; if(time>=25 && time<250) { double high= time/3; diff --git a/docs/answers.txt b/docs/answers.txt index 764e4b73..e1ee60c9 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -1,8 +1,8 @@ e.a) On branch master Your branch is up to date with 'origin/master'. -e.b) git rev-list --all --count -8 +e.b) git shortlog +17 e.c) git log --follow .gitignore