From dcde9a6c3fb505b6273ff8b278de99ccbd6b0433 Mon Sep 17 00:00:00 2001 From: trd16 <31514871+trd16@users.noreply.github.com> Date: Tue, 1 Oct 2019 20:13:36 -0400 Subject: [PATCH 01/31] Updated information files The information files have been updated to describe the current state of the repository. Repository owner information has been added to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e69de29b..f0e082d7 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,2 @@ +Name: Taylor Driver +FSUID: trd16 From 764adcdaff08bf2f2b2fe9551801a962e9897b06 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Wed, 2 Oct 2019 21:01:35 -0400 Subject: [PATCH 02/31] Add Docs Directory and Status File Edited repository by adding a docs directory and status file inside. --- docs/status.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/status.txt diff --git a/docs/status.txt b/docs/status.txt new file mode 100644 index 00000000..e69de29b From d87bcd62af5594cd5da1067fc656a13cd8b0e64e Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Wed, 2 Oct 2019 21:07:09 -0400 Subject: [PATCH 03/31] Create Answers File Edited the repository to include answers.txt file. --- docs/answers.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/answers.txt diff --git a/docs/answers.txt b/docs/answers.txt new file mode 100644 index 00000000..e69de29b From 58a10eaccfff942f34e5126164d46556ae642557 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Wed, 2 Oct 2019 22:06:25 -0400 Subject: [PATCH 04/31] Completed Answers in Answers.txt File Edited the answers.txt file in the docs folder by adding all answers to the questions. --- docs/answers.txt | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/docs/answers.txt b/docs/answers.txt index e69de29b..0de4c600 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -0,0 +1,69 @@ +a) + +Counting objects: 5, done. +Delta compression using up to 56 threads. +Compressing objects: 100% (2/2), done. +Writing objects: 100% (4/4), 383 bytes | 0 bytes/s, done. +Total 4 (delta 1), reused 0 (delta 0) +remote: Resolving deltas: 100% (1/1), completed with 1 local object. +To https://github.com/trd16/assignment2.git + dcde9a6..764adcd master -> master + +b) + +There have been 9 commits that have been done to the repository and I used +the [git rev-list --all --count] command to get this information. + +c) + +The .gitignore file was last modified on Wednesday September 25th and I used +the [git log .gitignore] command to get this information. + +d) + +Branches are used in a Git repository to retain the history of the original +line of development while also allowing mutliple people to work on a single +code work at the same time. + +e) + +Git log is used as a running record of commits while git status displays +the state of the working direcotry and lets you see which changes have +been made. + +f) + +I would use the command [git log -p Vehicle.h] to see when this specific +files was committed. + +g) + +I would use the command [git log --all --grep='file'] to see which commits +have commit messages with the word "file". + +h) + +In object oriented programming, inheritance is used to allow new objects to +take on properties of existing objects. Polymorphism is the concept of +objects of different types being accessed through the same interface. +Encapsulation is the briging together of data and methods that work +together in one unit like a class. + +i) + +The main difference between the dictator and lieutenants workflow +and the integration manager workflow is that dictator and lieutenants only +has one central repository that everyone pulls from and the dictator pushes +to while integration manager has two repositories per developer and each +developer can push or pull. + +j) + +How would a team of 100 developers benefit from following the "dicator and +lieutenants" workflow instead of the "centralized" workflow? +A team of 100 developers could benefit from using the dictator and lieutenants +workflow instead of the centralized workflow because instead of every developer +having to resolve conflicts before pushing only the dictator will control this +and there will be less issues arising or differences between code. + + From 5106aae6007af477ec5fa252cf5936b227108778 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 17:05:13 -0400 Subject: [PATCH 05/31] Created Jet.h File Edited the repository to include the Jet.h file. --- Jet.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Jet.h diff --git a/Jet.h b/Jet.h new file mode 100644 index 00000000..80573cf6 --- /dev/null +++ b/Jet.h @@ -0,0 +1,27 @@ +// +// Created by Taylor Driver on 9/5/19 +// + +#ifndef DRIVINGSIMULATOR_JET_H +#define DRIVINGSIMULATOR_CAR_H + +#include "PoweredVehicle.h" + +class Jet : public PoweredVehicle { + +private: + int numberOfEngines = 1; + +public: + Jet(); + + explicit Jet(string brand, string model, string fuelType, string engineSize); + + virtual ~Jet(); + string getEngineSize(); + void setEngineSize(string engineSize); + virtual double mileageEstimate(double time); + virtual string toString(); +}; + +#endif //DRIVINGSIMULATOR_CAR_H From 05b7bd82d2d056b17b4ee11126977b47c03187ed Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 17:30:05 -0400 Subject: [PATCH 06/31] Created Jet.cpp File Edited repository by adding the Jet.cpp file while includes important functions derived from the PoweredVehicle functions. --- Jet.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Jet.cpp diff --git a/Jet.cpp b/Jet.cpp new file mode 100644 index 00000000..56ae7458 --- /dev/null +++ b/Jet.cpp @@ -0,0 +1,62 @@ +// +// Created by Taylor Driver on 10/3/2019 +// + + +#include "Jet.h" +#include +#include +#include + +Jet::Jet() { + +} + +Jet::Jet(string brand, string model, string fuelType, string engineSize, int engineNum) { + setBrand(brand); + setModel(model); + setFuelType(fuelType); + setEngineSize(engineSize); + setEngineNum(engineNum); +} + + +Jet::~Jet() = default; + +string Jet::getEngineSize() { + return myEngineSize; +} + +string Jet::getEngineNum() { + return myEngineNum; +} + +void Jet::setEngineSize(string engineSize) { + if(engineSize == "unknown" || engineSize == "small" || engineSize == "medium" || engineSize == "grande") { + myEngineSize = engineSize; + } + else + { + myEngineSize = "unknown"; + } +} + +void Jet::setEngineNum(int engineNum) { + myEngineNum = engineNum; +} + +double Jet::mileageEstimate(double time) { + srand((unsigned)time(0)); + + double mileage = (rand() % 100) + 40; + + if(fuelType == "Rocket" && myEngineNum == 2) + mileage = mileage + 5.5; + + return mileage; +} + + +string Jet::toString() { + return "-> Jet\n" + PoweredVehicle::toString() + "\n\tEngine Size: " + getEngineSize(); +} From 4172b856aca13e2c84a1c5c4e92ae1e1ba84cc94 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 17:45:50 -0400 Subject: [PATCH 07/31] Added Skateboard.h Edited repository by adding Skateboard.h. --- Skateboard.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Skateboard.h diff --git a/Skateboard.h b/Skateboard.h new file mode 100644 index 00000000..d01ba1e4 --- /dev/null +++ b/Skateboard.h @@ -0,0 +1,23 @@ +// +// Created by Taylor Driver on 10/3/2019 +// + +#ifndef DRIVINGSIMULATOR_SKATEBOARD_H +#define DRIVINGSIMULATOR_SKATEBOARD_H + +#include "Vehicle.h" + +class Skateboard : public Vehicle { + + +public: + explicit Skateboard(string brand, string model); + + virtual ~Skateboard(); + virtual double mileageEstimate(double time); + + virtual string toString(); +}; + +#endif //DRIVINGSIMULATOR_SKATEBOAD_H + From 6f2c894aefa50cd54a7db4b1c29398fdf942f514 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 17:46:34 -0400 Subject: [PATCH 08/31] Created Skateboard.cpp File Edited repository by now adding the Skateboard.cpp file including all necessary functions to make the main file work correctly. --- Skateboard.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Skateboard.cpp diff --git a/Skateboard.cpp b/Skateboard.cpp new file mode 100644 index 00000000..a67aae8d --- /dev/null +++ b/Skateboard.cpp @@ -0,0 +1,32 @@ +// +//Created by Taylor Driver on 10/3/19 +// + +#include "Skateboard.h" +#include +#include +#include + +Skateboard::Skateboard(string brand, string model) { + setbrand(brand); + setModel(model); +} + +Skateboard::~Skateboard() = default; + +double Skateboard::mileageEstimate(double time) { + srand((unsigned)time(0)); + + double mileage = (rand() % .5) + .1; + + if(time>25 && time < 250) + mileage = mileage + ((rand() % time/3) + 1); + +} + +string Skateboard::toString() { + string s = "-> Skateboard\n\t"; + return "-> Skateboard\n" + Vehicle::toString(); + + +} From 06fdf674704de785aca77edcbcc94797f8bc3e6a Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 18:06:28 -0400 Subject: [PATCH 09/31] Fixed Random Generator Edited repository by fixing the random number generator in the Jet.cpp file. --- Jet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jet.cpp b/Jet.cpp index 56ae7458..38ac1f91 100644 --- a/Jet.cpp +++ b/Jet.cpp @@ -48,7 +48,7 @@ void Jet::setEngineNum(int engineNum) { double Jet::mileageEstimate(double time) { srand((unsigned)time(0)); - double mileage = (rand() % 100) + 40; + double mileage = (rand() % 100-39) + 40; if(fuelType == "Rocket" && myEngineNum == 2) mileage = mileage + 5.5; From 80b00a3a44b31b0209de3b9d17b60918edacf674 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 18:07:13 -0400 Subject: [PATCH 10/31] Added RollerCoaster.h File Edited repository by adding the RollerCoaster.h file to create my final PoweredVehicle. --- RollerCoaster.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 RollerCoaster.h diff --git a/RollerCoaster.h b/RollerCoaster.h new file mode 100644 index 00000000..e4db1e5c --- /dev/null +++ b/RollerCoaster.h @@ -0,0 +1,27 @@ +// +// Created by Taylor Driver on 10/3/19 +// + +#ifndef DRIVIGSIMULATOR_ROLLERCOASTER_H +#define DRIVINGSIMULATOR_ROLLERCOASTER_H + +#include "PoweredVehicle.h" + +class RollerCoaster : public PoweredVehicle { + +private: + string myEngineSize; + +public: + RollerCoaster(); + + explicit RollerCoaster(string manufacturer, string model, string fuelType, string engineSize); + + virtual ~Rollercoaster(); + string getEngineSize(); + void setEngineSize(String engineSize); + virtual double mileageEstimate(double time); + virtual string toString(); +}; + +#endif //DRIVINGSIMULATOR_ROLLERCOASTER_H From 90c535354b789c69d3a680ce2c77c4b28983d1ab Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 18:07:53 -0400 Subject: [PATCH 11/31] Created RollerCoaster.cpp File Edited repository by creating the RollerCoaster.cpp file and creating functions derived from the PoweredVehicle class. --- RollerCoaster.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 RollerCoaster.cpp diff --git a/RollerCoaster.cpp b/RollerCoaster.cpp new file mode 100644 index 00000000..917f7207 --- /dev/null +++ b/RollerCoaster.cpp @@ -0,0 +1,48 @@ +// +// Created by Taylor Driver on 10/3/19 +// + +#include "RollerCoaster.h" + +RollerCoaster::RollerCoaster() { + myEngineSize = "unknown"; + setManufacturer("B&M"); + setModel("Wooden"); +} + +RollerCoaster::RollerCoaster(string manufacturer, stirng model, string fuelType, string engineSize) { + setManufacturer(manufacturer); + setModel(model); + setFuelType(fuelType); + setEngineSize(engineSize); +} + + +RollerCoaster::~RollerCoaster() = default; + +string RollerCoaster::getEngineSize() { + return myEngineSize; +} + +void RollerCoaster::setEngineSize(string engineSize) { + if(engineSize == "unknown" || engineSize == "small" || engineSize == "medium" || engineSize == "grande") { + myEngineSize = engineSize; + else + myEngineSize = "unknown"; +} + +double RollerCoaster::mileageEstimate(double time) { + srand((unsigned)time(0)); + //double mileage = time * 20; + + if(model == "Wooden") { + double mileage = time * ((rand() % 72-4) + 5); + + +return mileage; +} + + +string RollerCoaster::toString() { + return "-> RollerCoaster\n" + PoweredVehicle::toString() + "\n\tEngine Size: " + getEngineSize(); +} From aee42fc41d82d79dd7d3709e07ea003a93ce3209 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:21:47 -0400 Subject: [PATCH 12/31] Added Parameter to Constructor Edited repository by adding name to the RollerCoaster.cpp file. --- RollerCoaster.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RollerCoaster.cpp b/RollerCoaster.cpp index 917f7207..71b34aeb 100644 --- a/RollerCoaster.cpp +++ b/RollerCoaster.cpp @@ -10,8 +10,9 @@ RollerCoaster::RollerCoaster() { setModel("Wooden"); } -RollerCoaster::RollerCoaster(string manufacturer, stirng model, string fuelType, string engineSize) { +RollerCoaster::RollerCoaster(string manufacturer, string name, string model, string fuelType, string engineSize) { setManufacturer(manufacturer); + setName(name); setModel(model); setFuelType(fuelType); setEngineSize(engineSize); From 966f46ae386aff93fc8beb6b6c4dcc873d44136c Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:22:56 -0400 Subject: [PATCH 13/31] Added Parameter to Constructor Edited repository by adding the parameter name to the constructor in the RollerCoaster.h file. --- RollerCoaster.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RollerCoaster.h b/RollerCoaster.h index e4db1e5c..610c40aa 100644 --- a/RollerCoaster.h +++ b/RollerCoaster.h @@ -15,7 +15,7 @@ class RollerCoaster : public PoweredVehicle { public: RollerCoaster(); - explicit RollerCoaster(string manufacturer, string model, string fuelType, string engineSize); + explicit RollerCoaster(string manufacturer, string name, string model, string fuelType, string engineSize); virtual ~Rollercoaster(); string getEngineSize(); From ffb4e000d4e749ff253f5dca14b69995120608b5 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:26:16 -0400 Subject: [PATCH 14/31] Added Test Cases Edited repository by adding test cases for Jet, Skateboard, and RollerCoaster in the main.cpp file. --- main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index ba0b6928..d7828eb5 100644 --- a/main.cpp +++ b/main.cpp @@ -7,7 +7,7 @@ void printVehiclesRoster(Vehicle **vehicles, int size); int main() { std::cout << "Driving simulator" << std::endl; int size = 6; - int capacity = 10; + int capacity = 12; Vehicle **vehiclesArray = new Vehicle *[capacity]; vehiclesArray[0] = new Car(); @@ -16,6 +16,12 @@ 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 Jet("Cessna", "Citation", "diesel", "grande"); + vehiclesArray[7] = new Jet("Learjet", "31", "diesel", "grande"); + vehiclesArray[8] = new Skateboard("Zero", "Sandoval"); + vehiclesArray[9] = new Skateboard("Element", "Jaakko"); + vehiclesArray[10] = new RollerCoaster("Intamin","Taron", "Steel","diesel", "medium"); + vehiclesArray[11] = new RollerCoaster("Vekoma", "Invertigo", "Steel", "diesel", "grande"); printVehiclesRoster(vehiclesArray, size); @@ -37,4 +43,4 @@ void printVehiclesRoster(Vehicle **vehicles, int size) { << vehicles[i]->mileageEstimate(simulatedDistance) << " miles in " << simulatedDistance << " seconds" << endl; } -} \ No newline at end of file +} From ab463a09631f09aa9bba759c3059d0ab874ae905 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:31:55 -0400 Subject: [PATCH 15/31] Added Dependencies at Top of File Edited repository by adding dependencies of header files at the top of the main.cpp file. --- main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.cpp b/main.cpp index d7828eb5..729db7fc 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,9 @@ #include #include "Car.h" #include "Bicycle.h" +#include "Jet.h" +#include "Skateboard.h" +#include "RollerCoaster.h" void printVehiclesRoster(Vehicle **vehicles, int size); From 1ceb4ca006a6ec2f767af672cd83c38556955a7b Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:36:26 -0400 Subject: [PATCH 16/31] Small Typo Fixes Edited RollerCoaster.h file by fixing small typos. --- RollerCoaster.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RollerCoaster.h b/RollerCoaster.h index 610c40aa..ad8a6729 100644 --- a/RollerCoaster.h +++ b/RollerCoaster.h @@ -2,7 +2,7 @@ // Created by Taylor Driver on 10/3/19 // -#ifndef DRIVIGSIMULATOR_ROLLERCOASTER_H +#ifndef DRIVINGSIMULATOR_ROLLERCOASTER_H #define DRIVINGSIMULATOR_ROLLERCOASTER_H #include "PoweredVehicle.h" @@ -19,7 +19,7 @@ class RollerCoaster : public PoweredVehicle { virtual ~Rollercoaster(); string getEngineSize(); - void setEngineSize(String engineSize); + void setEngineSize(string engineSize); virtual double mileageEstimate(double time); virtual string toString(); }; From 7db7b7adaa5cf312f64d5a2e3aabbf2888163d05 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:38:19 -0400 Subject: [PATCH 17/31] Fixed Another Typo Edited RollerCoaster.h file by fixing another typo found after running program. --- RollerCoaster.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RollerCoaster.h b/RollerCoaster.h index ad8a6729..f44ab2ed 100644 --- a/RollerCoaster.h +++ b/RollerCoaster.h @@ -17,7 +17,7 @@ class RollerCoaster : public PoweredVehicle { explicit RollerCoaster(string manufacturer, string name, string model, string fuelType, string engineSize); - virtual ~Rollercoaster(); + virtual ~RollerCoaster(); string getEngineSize(); void setEngineSize(string engineSize); virtual double mileageEstimate(double time); From 47f16c1af3edcf7009287d94c322e6f6629447ca Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:40:28 -0400 Subject: [PATCH 18/31] Fixed Typo Edited main.cpp file to fix a typo found while running program. --- main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 729db7fc..1c0e5c96 100644 --- a/main.cpp +++ b/main.cpp @@ -19,8 +19,8 @@ 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 Jet("Cessna", "Citation", "diesel", "grande"); - vehiclesArray[7] = new Jet("Learjet", "31", "diesel", "grande"); + vehiclesArray[6] = new Jet("Cessna", "Citation", "diesel", "grande",2); + vehiclesArray[7] = new Jet("Learjet", "31", "diesel", "grande",1); vehiclesArray[8] = new Skateboard("Zero", "Sandoval"); vehiclesArray[9] = new Skateboard("Element", "Jaakko"); vehiclesArray[10] = new RollerCoaster("Intamin","Taron", "Steel","diesel", "medium"); From 394532cc1149acf1f341f458c9210f0942d298b5 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:42:36 -0400 Subject: [PATCH 19/31] Fixed Some Typos Edited Jet.h to fix some typos by adding the correct parameters to the constructor. --- Jet.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jet.h b/Jet.h index 80573cf6..bab02b1e 100644 --- a/Jet.h +++ b/Jet.h @@ -15,11 +15,13 @@ class Jet : public PoweredVehicle { public: Jet(); - explicit Jet(string brand, string model, string fuelType, string engineSize); + explicit Jet(string brand, string model, string fuelType, string engineSize, int engineNum); virtual ~Jet(); string getEngineSize(); + string getEngineNum(); void setEngineSize(string engineSize); + void setEngineNum(int engineNum); virtual double mileageEstimate(double time); virtual string toString(); }; From 1d2a96e82e7f36ec50ff690a81073bd8d7ce07ed Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:46:13 -0400 Subject: [PATCH 20/31] More Typos Edited Jet.h file for more typos found. --- Jet.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jet.h b/Jet.h index bab02b1e..ac37ace3 100644 --- a/Jet.h +++ b/Jet.h @@ -3,7 +3,7 @@ // #ifndef DRIVINGSIMULATOR_JET_H -#define DRIVINGSIMULATOR_CAR_H +#define DRIVINGSIMULATOR_JET_H #include "PoweredVehicle.h" @@ -11,6 +11,7 @@ class Jet : public PoweredVehicle { private: int numberOfEngines = 1; + string myEngineSize; public: Jet(); @@ -26,4 +27,4 @@ class Jet : public PoweredVehicle { virtual string toString(); }; -#endif //DRIVINGSIMULATOR_CAR_H +#endif //DRIVINGSIMULATOR_JET_H From 7c3d07336928d7eb3c946382fcbf16df950e58fa Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:48:36 -0400 Subject: [PATCH 21/31] More Typos Edited Jet.cpp to fix more typos found. --- Jet.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jet.cpp b/Jet.cpp index 38ac1f91..ce5e4eb0 100644 --- a/Jet.cpp +++ b/Jet.cpp @@ -9,7 +9,9 @@ #include Jet::Jet() { - + myEngineSize = "unknown"; + setBrand("Custom"); + setModel("V6"); } Jet::Jet(string brand, string model, string fuelType, string engineSize, int engineNum) { From bcb7ce5aacbeda50d1bb35709e63fb401054f559 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:50:02 -0400 Subject: [PATCH 22/31] Adding Engine Num Edited Jet.cpp to include engine num where necessary. --- Jet.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Jet.cpp b/Jet.cpp index ce5e4eb0..30b0963c 100644 --- a/Jet.cpp +++ b/Jet.cpp @@ -10,6 +10,7 @@ Jet::Jet() { myEngineSize = "unknown"; + myEngineNum = 1; setBrand("Custom"); setModel("V6"); } From 93c7f055a1d808a2fd6ccc65f500a0bb765b9ce0 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 19:51:21 -0400 Subject: [PATCH 23/31] Adding Engine Num Edited Jet.h to include enginenum int. --- Jet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jet.h b/Jet.h index ac37ace3..262aa2f8 100644 --- a/Jet.h +++ b/Jet.h @@ -10,7 +10,7 @@ class Jet : public PoweredVehicle { private: - int numberOfEngines = 1; + int myEngineNum = 1; string myEngineSize; public: From b4deb19366f12e0df9efc3b76e254965f3fccb1c Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Thu, 3 Oct 2019 20:35:06 -0400 Subject: [PATCH 24/31] Fixed Typo Edited Skateboard.cpp file to fix a typo found when running program. --- Skateboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Skateboard.cpp b/Skateboard.cpp index a67aae8d..302b7bb4 100644 --- a/Skateboard.cpp +++ b/Skateboard.cpp @@ -8,7 +8,7 @@ #include Skateboard::Skateboard(string brand, string model) { - setbrand(brand); + setBrand(brand); setModel(model); } From b1ceab8b3defc68045ccb73e6a4f170b396d130a Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Fri, 4 Oct 2019 18:26:40 -0400 Subject: [PATCH 25/31] Final Commit All bugs and typos have been fixed in Jet.cpp file. --- Jet.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Jet.cpp b/Jet.cpp index 30b0963c..0b071d73 100644 --- a/Jet.cpp +++ b/Jet.cpp @@ -7,6 +7,10 @@ #include #include #include +#include +#include +#include +#include Jet::Jet() { myEngineSize = "unknown"; @@ -30,7 +34,7 @@ string Jet::getEngineSize() { return myEngineSize; } -string Jet::getEngineNum() { +int Jet::getEngineNum() { return myEngineNum; } @@ -49,9 +53,14 @@ void Jet::setEngineNum(int engineNum) { } double Jet::mileageEstimate(double time) { - srand((unsigned)time(0)); - - double mileage = (rand() % 100-39) + 40; + //srand(time(NULL)); + //double mileage = (rand() % 100-39) + 40; + //used Cubbi's answer on StackOverflow's "Random Number c++ in some range" + std::random_device rd; + std::mt19937 rng(rd()); + std::uniform_int_distribution uni(40,100); + int randnum = uni(rng); + double mileage = randnum * time; if(fuelType == "Rocket" && myEngineNum == 2) mileage = mileage + 5.5; From 200391f2f94a5e6ce6fd687dcfa7e3888204e99d Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Fri, 4 Oct 2019 18:27:07 -0400 Subject: [PATCH 26/31] Final Commit All bugs and typos have been fixed in the Jet.h file. --- Jet.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jet.h b/Jet.h index 262aa2f8..1dfed0fb 100644 --- a/Jet.h +++ b/Jet.h @@ -10,7 +10,7 @@ class Jet : public PoweredVehicle { private: - int myEngineNum = 1; + int myEngineNum; string myEngineSize; public: @@ -20,7 +20,7 @@ class Jet : public PoweredVehicle { virtual ~Jet(); string getEngineSize(); - string getEngineNum(); + int getEngineNum(); void setEngineSize(string engineSize); void setEngineNum(int engineNum); virtual double mileageEstimate(double time); From 8d2a9d6116a8619cb9e662cafbca6eebbc8b17ff Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Fri, 4 Oct 2019 18:27:34 -0400 Subject: [PATCH 27/31] Final Commit All bugs and typos have been fixed in the RollerCoaster.h file. --- RollerCoaster.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/RollerCoaster.h b/RollerCoaster.h index f44ab2ed..3f8610b8 100644 --- a/RollerCoaster.h +++ b/RollerCoaster.h @@ -11,7 +11,9 @@ class RollerCoaster : public PoweredVehicle { private: string myEngineSize; - + string myManufacturer; + string myName; + string myModel; public: RollerCoaster(); @@ -19,7 +21,13 @@ class RollerCoaster : public PoweredVehicle { virtual ~RollerCoaster(); string getEngineSize(); + string getManufacturer(); + string getName(); + string getModel(); + void setManufacturer(string manufacturer); void setEngineSize(string engineSize); + void setName(string name); + void setModel(string model); virtual double mileageEstimate(double time); virtual string toString(); }; From 462145ee2ff7f5f915f32fafe4f8e6fdc3cc3dcd Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Fri, 4 Oct 2019 18:28:21 -0400 Subject: [PATCH 28/31] Final Commit All bugs and typos have been fixed in the RollerCoaster.cpp file. --- RollerCoaster.cpp | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/RollerCoaster.cpp b/RollerCoaster.cpp index 71b34aeb..e539b0a8 100644 --- a/RollerCoaster.cpp +++ b/RollerCoaster.cpp @@ -6,8 +6,9 @@ RollerCoaster::RollerCoaster() { myEngineSize = "unknown"; - setManufacturer("B&M"); - setModel("Wooden"); + myManufacturer = "unknown"; + myName = "unknown"; + myModel = "unknown"; } RollerCoaster::RollerCoaster(string manufacturer, string name, string model, string fuelType, string engineSize) { @@ -25,18 +26,42 @@ string RollerCoaster::getEngineSize() { return myEngineSize; } +string RollerCoaster::getManufacturer() { + return myManufacturer; +} + +string RollerCoaster::getName() { + return myName; +} + +string RollerCoaster::getModel() { + return myModel; +} + void RollerCoaster::setEngineSize(string engineSize) { - if(engineSize == "unknown" || engineSize == "small" || engineSize == "medium" || engineSize == "grande") { + if(engineSize == "unknown" || engineSize == "small" || engineSize == "medium" || engineSize == "grande") myEngineSize = engineSize; else myEngineSize = "unknown"; } +void RollerCoaster::setManufacturer(string manufacturer) { + myManufacturer = manufacturer; +} + +void RollerCoaster::setName(string name) { + myName = name; +} + +void RollerCoaster::setModel(string model) { + myModel = model; +} + double RollerCoaster::mileageEstimate(double time) { - srand((unsigned)time(0)); - //double mileage = time * 20; + //srand((unsigned)time(0)); + double mileage = time * 20; - if(model == "Wooden") { + if(myModel == "Wooden") double mileage = time * ((rand() % 72-4) + 5); @@ -45,5 +70,5 @@ return mileage; string RollerCoaster::toString() { - return "-> RollerCoaster\n" + PoweredVehicle::toString() + "\n\tEngine Size: " + getEngineSize(); + return "-> RollerCoaster" + std::string("\n\tManufacturer: ") + getManufacturer() + std::string("\n\tModel: ") + getModel() + std::string("\n\tName: ") + getName() + std::string("\n\tFuel Type: ") + getFuelType() + std::string("\n\tEngine Size: ") + getEngineSize(); } From 855f74e4f8c55e4f62c9a0cb778f0b05dc04919b Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Fri, 4 Oct 2019 18:29:11 -0400 Subject: [PATCH 29/31] Final Commit All bugs and typos have been fixed in the Skateboard.cpp file. --- Skateboard.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Skateboard.cpp b/Skateboard.cpp index 302b7bb4..a1f632d8 100644 --- a/Skateboard.cpp +++ b/Skateboard.cpp @@ -6,6 +6,8 @@ #include #include #include +#include +#include Skateboard::Skateboard(string brand, string model) { setBrand(brand); @@ -15,13 +17,23 @@ Skateboard::Skateboard(string brand, string model) { Skateboard::~Skateboard() = default; double Skateboard::mileageEstimate(double time) { - srand((unsigned)time(0)); - - double mileage = (rand() % .5) + .1; - - if(time>25 && time < 250) - mileage = mileage + ((rand() % time/3) + 1); - + //double mileage = .5 + (std::rand() % (.5-.1+1)) //(double) rand()/(.5 + 1) + .1 + ((double)rand()%.4); + //mileage = (int) floor(mileage); + //double mileage = rand() * 1.0 / .5 * (.5-.1+1) + .1; + //used Cubbi's answer on StackOverflow's "random number c++ in some range" + + std::random_device rd; + std::mt19937 rng(rd()); + std::uniform_real_distribution dist(0.1,0.5); + double randnum = dist(rng); + + double mileage = randnum * time; + + if(time>25.0 && time < 250.0){ + //mileage = mileage + (double)rand()/(time/3) + 1; + std::uniform_real_distribution dist(0.1,time/3); + mileage = mileage + dist(rng); + } } string Skateboard::toString() { From 6de4185d2c6ae0137dafdee96e3f31d106ced678 Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Fri, 4 Oct 2019 18:29:53 -0400 Subject: [PATCH 30/31] Final Commit All necessary changes and all bugs and typos have been fixed for the main.cpp file. --- main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 1c0e5c96..2066ccb1 100644 --- a/main.cpp +++ b/main.cpp @@ -8,8 +8,10 @@ void printVehiclesRoster(Vehicle **vehicles, int size); int main() { + srand((unsigned)time(0)); + std::cout << "Driving simulator" << std::endl; - int size = 6; + int size = 12; int capacity = 12; Vehicle **vehiclesArray = new Vehicle *[capacity]; From 7c0d2ae2d454e5de32e4ec42e87083da4e56a29a Mon Sep 17 00:00:00 2001 From: Taylor Rene Driver Date: Fri, 4 Oct 2019 18:36:23 -0400 Subject: [PATCH 31/31] Final Commit Edited answers.txt to include OOP Principles question answers and to add my name. --- docs/answers.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/answers.txt b/docs/answers.txt index 0de4c600..41fe2246 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -1,3 +1,9 @@ +// +// Taylor Driver created on 10/4/2019 +// + + +4. a) Counting objects: 5, done. @@ -67,3 +73,6 @@ having to resolve conflicts before pushing only the dictator will control this and there will be less issues arising or differences between code. +5. +The Driving simulator prototype is using polymorphism and I can tell this because +function overloading can occur and the classes all inherit from one specific class.