From 5059634c14c3a66be7e3b005cf7099f97393f8fc Mon Sep 17 00:00:00 2001 From: NickWattsCS <46544773+NickWattsCS@users.noreply.github.com> Date: Thu, 3 Oct 2019 18:42:44 -0400 Subject: [PATCH 01/30] Added name and handle --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e69de29b..2a727dd1 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,2 @@ +Name: Nicholas Watts +FSUID: nsw12b From 6f4b436f5d97a2b46759b79851d0f62e07734d4f Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 18:01:47 -0400 Subject: [PATCH 02/30] Added status file to docs folder. --- docs/status.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 docs/status.txt diff --git a/docs/status.txt b/docs/status.txt new file mode 100644 index 00000000..af92b574 --- /dev/null +++ b/docs/status.txt @@ -0,0 +1,4 @@ +On branch master +Your branch is up to date with 'origin/master'. + +nothing to commit, working tree clean From 3bd8a3f4d6161ca4cd6b2bbe87f13b90545eb1e6 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 18:24:01 -0400 Subject: [PATCH 03/30] Adding the doc answers.txt to the docs folder --- docs/answers.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs/answers.txt diff --git a/docs/answers.txt b/docs/answers.txt new file mode 100644 index 00000000..c9960c00 --- /dev/null +++ b/docs/answers.txt @@ -0,0 +1,17 @@ +1) "Enumerating objects: 8, done. +Counting objects: 100% (8/8), done. +Delta compression using up to 4 threads +Compressing objects: 100% (5/5), done. +Writing objects: 100% (6/6), 672 bytes | 336.00 KiB/s, done. +Total 6 (delta 2), reused 0 (delta 0) +remote: Resolving deltas: 100% (2/2), completed with 1 local object. +remote: +remote: Create a pull request for '45c1cb8' on GitHub by visiting: +remote: https://github.com/NickWattsCS/assignment2/pull/new/45c1cb8 +remote: +To https://github.com/NickWattsCS/assignment2 + * [new branch] HEAD -> 45c1cb8 +" + +The reason that HEADD is pointing to 45c1cb8 and not master is because I had some issues with +pushing the new changes at first. From 288fc5134480f7876844705216686aa279b1d363 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 19:11:02 -0400 Subject: [PATCH 04/30] =added answers b through e in answers.txt --- docs/answers.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/answers.txt b/docs/answers.txt index c9960c00..6331595a 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -1,4 +1,4 @@ -1) "Enumerating objects: 8, done. +a) "Enumerating objects: 8, done. Counting objects: 100% (8/8), done. Delta compression using up to 4 threads Compressing objects: 100% (5/5), done. @@ -15,3 +15,18 @@ To https://github.com/NickWattsCS/assignment2 The reason that HEADD is pointing to 45c1cb8 and not master is because I had some issues with pushing the new changes at first. + +b) using the "git log" command, I was able to see that there are currently four commits added +to the reposirtory, all of which were made by me. + +c) I used the commend "git log .gitignore" to find out that the file .gitignore was last updated +'Wed Sep 25 18:13:30 2019 -0400,' as reported by the console. + +d) Branches are used to create an alternative version of the parent directory, either to +differentiate workflow between different users, or to differntiate two functionally different +versions of the repository. + +e) git log returns the commit log of a repository, or returns commit information about a given +commit. In contrast, git status returns the current state of the git machine, and whether there +are any changes between the remote and the local versions of the repository that have yet to been +pushed onto the origin. From 73f2cb8ce203789c2c7acd2325024ced445f3d07 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 19:23:04 -0400 Subject: [PATCH 05/30] =Added f and g to answers.txt --- docs/answers.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/answers.txt b/docs/answers.txt index 6331595a..7572f615 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -30,3 +30,10 @@ e) git log returns the commit log of a repository, or returns commit information commit. In contrast, git status returns the current state of the git machine, and whether there are any changes between the remote and the local versions of the repository that have yet to been pushed onto the origin. + +f) To see any commits involving the file Vehicle.h, just type "git log Vehicle.h". + +g) To get all commits that use the word "file," include the flag "--grep='file'" to make the +command line read "git log --grep='file'" + + From 27f20e3e91dfdf0eb964862ed504757b26fd456b Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 19:34:14 -0400 Subject: [PATCH 06/30] added part h to answers.txt --- docs/answers.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/answers.txt b/docs/answers.txt index 7572f615..7a7947a6 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -36,4 +36,12 @@ f) To see any commits involving the file Vehicle.h, just type "git log Vehicle.h g) To get all commits that use the word "file," include the flag "--grep='file'" to make the command line read "git log --grep='file'" - +h) +I) Inheritance is the object-oriented concept where one class is derived from another class, +meaning that the derived class has access to functions from the parent class as well as its own +distinct functions. +II) Polymorphism is a concept of inheritance that says that an object of a derived child class is +also an object of the parent class. +III) Encapsulation is a concept of object-oriented programming where functions and data that +should not be accessible is made private from users. This is to avoid any undesirable +manipulation of sensitive data. From 14a93384932fe8819bde960722eeeb7446369da6 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 20:03:55 -0400 Subject: [PATCH 07/30] added i to answers.txt --- docs/answers.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/answers.txt b/docs/answers.txt index 7a7947a6..327f399c 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -45,3 +45,18 @@ also an object of the parent class. III) Encapsulation is a concept of object-oriented programming where functions and data that should not be accessible is made private from users. This is to avoid any undesirable manipulation of sensitive data. + +i) The main difference between the two workflow models is the level of control that the +developers have to push to the blessed repository. In both models, developers can pull from the +blessed repository. However, this is where the two processes diverge. + +Integration management allows developers to push to their own public repositories. From that +point, an integration manager finds and resolves any conflicts between the different +repositories, and publishes the final repository to the blessed repository. In this version, the +developers have more direct control over what appears in the blessed repository. + +In the Dictators and Lieutenants workflow, devlopers must push their repositories to designated +"lieutenant" repositories. From there, a separate entity, the "dictator", merges the two +repositories and resolves any conflicts. This is called the dictator repository, which is then +pushed onto the blessed repository. This allows for more regulatory control over the developers' +individual contributions. From b37dc56a3032e213b75d0ba518b771a29e786401 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 20:09:53 -0400 Subject: [PATCH 08/30] Added part i to answers.txt --- docs/answers.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/answers.txt b/docs/answers.txt index 327f399c..10d1f5d0 100644 --- a/docs/answers.txt +++ b/docs/answers.txt @@ -60,3 +60,11 @@ In the Dictators and Lieutenants workflow, devlopers must push their repositorie repositories and resolves any conflicts. This is called the dictator repository, which is then pushed onto the blessed repository. This allows for more regulatory control over the developers' individual contributions. + +j) A team of 100 developers would benefit from Dictator and Lieutenant workforce because it +allows the project manager to oversee version control before the work done by those developers is +pushed to the final repository. This allows the project manager to resolve the +torrent of issues that would certainly arise from 100 different versions of one project being +coallesced into one product. This can also give the project manager a level of oversight by +allowing him to insert or remove any code that they may want before pushing it to the blessed +repository. From 8d9895d7fd1d8bd9c1cde27d0e4632fa619dd385 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 20:12:06 -0400 Subject: [PATCH 09/30] Edited README to make the newline more pronounced --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2a727dd1..db7bc62b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ Name: Nicholas Watts + FSUID: nsw12b From 84524d92f86e78b42186a1973957928b87b1d6bc Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 20:20:22 -0400 Subject: [PATCH 10/30] Added numberOfGears and mileage member data to Bicyle.h --- Bicycle.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Bicycle.h b/Bicycle.h index 61b7ca3d..1104780a 100644 --- a/Bicycle.h +++ b/Bicycle.h @@ -2,6 +2,8 @@ // Created by Esteban Parra on 9/5/19. // +//Edits made by Nicholas Watts where noted + #ifndef DRIVINGSIMULATOR_BICYCLE_H #define DRIVINGSIMULATOR_BICYCLE_H @@ -11,9 +13,13 @@ class Bicycle : public Vehicle { private: int myGearCount; + int numberOfGears; //NW added member data + int mileage; public: - explicit Bicycle(string brand, string model, int gearCount = 1); + explicit Bicycle(string brand, string model, int gearCount = 1, + int numberOfGears = 3, int mileage = 3); +//NW added default parameter virtual ~Bicycle(); int getGearCount(); From 6c6555f1b974f8ac9ca7741acf1a567df13645d8 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 20:27:46 -0400 Subject: [PATCH 11/30] Restored Bicycle.h and Bicycle.cpp to their original versions Originally, I was under the impression that things needed to be added to these files, but now I see this was an error. As a result, the files have been restored to their original versions. --- Bicycle.cpp | 2 +- Bicycle.h | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Bicycle.cpp b/Bicycle.cpp index 87dd0708..ad8e38b6 100644 --- a/Bicycle.cpp +++ b/Bicycle.cpp @@ -31,4 +31,4 @@ string Bicycle::toString() { string s = "-> Bicycle\n\t"; return "-> Bicycle\n" + Vehicle::toString() + "\n\tGears: " + to_string(myGearCount); -} \ No newline at end of file +} diff --git a/Bicycle.h b/Bicycle.h index 1104780a..6e04a4b9 100644 --- a/Bicycle.h +++ b/Bicycle.h @@ -13,13 +13,9 @@ class Bicycle : public Vehicle { private: int myGearCount; - int numberOfGears; //NW added member data - int mileage; public: - explicit Bicycle(string brand, string model, int gearCount = 1, - int numberOfGears = 3, int mileage = 3); -//NW added default parameter + explicit Bicycle(string brand, string model, int gearCount = 1); virtual ~Bicycle(); int getGearCount(); From 3b8ba5461da9e4f1be1b1570b006aa9f99c712c8 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 20:35:45 -0400 Subject: [PATCH 12/30] Added Jet, Skateboard, and Monorail source files --- Jet.cpp | 0 Jet.h | 0 Monorail.cpp | 0 Monorail.h | 0 Skateboard.cpp | 0 Skateborad.h | 0 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Jet.cpp create mode 100644 Jet.h create mode 100644 Monorail.cpp create mode 100644 Monorail.h create mode 100644 Skateboard.cpp create mode 100644 Skateborad.h diff --git a/Jet.cpp b/Jet.cpp new file mode 100644 index 00000000..e69de29b diff --git a/Jet.h b/Jet.h new file mode 100644 index 00000000..e69de29b diff --git a/Monorail.cpp b/Monorail.cpp new file mode 100644 index 00000000..e69de29b diff --git a/Monorail.h b/Monorail.h new file mode 100644 index 00000000..e69de29b diff --git a/Skateboard.cpp b/Skateboard.cpp new file mode 100644 index 00000000..e69de29b diff --git a/Skateborad.h b/Skateborad.h new file mode 100644 index 00000000..e69de29b From 59e016e004e80189c06bc57cf0b0afb2a19ed2db Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 20:49:26 -0400 Subject: [PATCH 13/30] Added interface to Jet.h All function prototypes added in Jet.h are modeled after those in Bicycle.h and Car.h --- Jet.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Jet.h b/Jet.h index e69de29b..81126ed9 100644 --- a/Jet.h +++ b/Jet.h @@ -0,0 +1,26 @@ +//This file was written by Nicholas Watts on Oct 4, 2019. +//Code modeled on Bicycle.h and Car.h in parts, with differences +//in implementation annotated. + +#ifndef DRIVINGSIMULATOR_JET_H +#define DRIVINGSIMULATOR_JET_H + +#include "PoweredVehicle.h" + +class Jet: public PoweredVehicle { + +private: + int numberOfEngines; + +public: + Jet(); + explicit Jet(string brand, string model, string fuelType, + int engineNum); //number of engines to be copied to private data + virtual ~Jet(); + int getNumberEngines(); //NW added + void setNumberEngines(int newNum); //NW added + virtual double mileageEstimate(double time); + virtual string toString(); +}; + +#endif From b97209e2c8e544971237bae9381d087cab1767c2 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 20:55:37 -0400 Subject: [PATCH 14/30] Made numEngines a default parameter Initially numEngines was a normal parameter. However, I remembered it needed to be a default parameter of 1, so I made it so. --- Jet.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jet.h b/Jet.h index 81126ed9..6029db8d 100644 --- a/Jet.h +++ b/Jet.h @@ -15,7 +15,8 @@ class Jet: public PoweredVehicle { public: Jet(); explicit Jet(string brand, string model, string fuelType, - int engineNum); //number of engines to be copied to private data + int engineNum = 1); //number of engines to be copied to + //private data virtual ~Jet(); int getNumberEngines(); //NW added void setNumberEngines(int newNum); //NW added From 1516451027351ab3bacaa62612d9303dfe6b3f71 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 21:09:28 -0400 Subject: [PATCH 15/30] Included Cstdlib in Vehicle.h Now all objects derived from Vehicle.h can also create a random number generator in the necessary functions. --- Vehicle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vehicle.h b/Vehicle.h index 2ac751f3..6dcce98a 100644 --- a/Vehicle.h +++ b/Vehicle.h @@ -6,7 +6,7 @@ #define DRIVINGSIMULATOR_VEHICLE_H #include // std::string, std::stoi - +#include //NW added here to make random number generators in all children objects using namespace std; class Vehicle { From 381af07e3ef66125f8d76d619f62a79c96b10ecb Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 21:25:44 -0400 Subject: [PATCH 16/30] Added function definitions All functions are modeled off of those in Car.cpp except for mileageEstimate, which is implemented based off the requirements listed in the assignment2.pdf --- Jet.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/Jet.cpp b/Jet.cpp index e69de29b..872a788c 100644 --- a/Jet.cpp +++ b/Jet.cpp @@ -0,0 +1,54 @@ +//Created by Nicholas Watts on Oct 4, 2019 +//The functions in this file are modeled on those in Car.cpp and Bicycle.cpp, +//except for where changes were made, as annotated. + +#include "Jet.h" + +Jet::Jet() +{ + numberOfEngines = 0; + setBrand("Unknown"); + setModel("Unknown"); +} + +Jet::Jet(string brand, string model, string fuelType, int numEngines) +{ + setBrand(brand); + setModel(model); + setFuelType(fuelType); + setNumberEngines(numEngines); +} + +Jet::~Jet() = default; + +int Jet::getNumberEngines() +{ + return numberOfEngines; +} + +//NW If the number of engines provided is less than zero, it stays the same. +//Otherwise, the number of engines is updated. +void Jet::setNumberEngines(int newNum) +{ + if (newNum >= 0) + numberOfEngines = newNum; +} + +//NW This function has been changed to match the specifications as given in the +//.pdf provided for the assignment. +double Jet::mileageEstimate(double time) +{ + srand(time(0)); + double mileage = rand() % 60 + 40.0; + if (numberOfEngines > 2 && fuelType == "Rocket") + for (int i = 0; i < numberOfEngines; i++) + mileage += mileage*0.055; + return mileage; + +} + +string Jet::toString() +{ + return "-> Jet\n" + PoweredVehicle::toString() + "\n\tNumber of Engines: " + + getNumberEngines(); +} From 823e37118f31890ca4d3bdf1529e2f4a8af50689 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 21:35:23 -0400 Subject: [PATCH 17/30] Added interface Added functions to construct and destruct object, as well as a function to calculate the mileage. --- Skateboard.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Skateboard.h diff --git a/Skateboard.h b/Skateboard.h new file mode 100644 index 00000000..6f45377a --- /dev/null +++ b/Skateboard.h @@ -0,0 +1,22 @@ +//Created by Nicholas Watts on Oct 4, 2019 +//The function prototypes in this interface are based off of those +//provided in Bicycle.h, except where annotated. + +#ifndef DRIVINGSIMULATOR_SKATEBOARD_H +#define DRIVINGSIMULATOR_SKATEBOARD_H + +#include "Vehicle.h" + +class Skateboard: public Vehicle +{ + +private: + +public: + explicit Skateboard(string brand, string model); + virtual ~Skateboard(); + virtual double mileageEstimate(double time); + virtual string toString(); +}; + +#endif From 1db9cd99c6b392f2f4ad07f781d74b7fffd95f44 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 21:45:08 -0400 Subject: [PATCH 18/30] Changed method of calculating mileage Initially a for loop was used to account for the percentage increase for each engine. However, this was changed to a single multiplication using the Bicycle.cpp implementation as a model. --- Jet.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jet.cpp b/Jet.cpp index 872a788c..6bc651d4 100644 --- a/Jet.cpp +++ b/Jet.cpp @@ -41,8 +41,7 @@ double Jet::mileageEstimate(double time) srand(time(0)); double mileage = rand() % 60 + 40.0; if (numberOfEngines > 2 && fuelType == "Rocket") - for (int i = 0; i < numberOfEngines; i++) - mileage += mileage*0.055; + mileage += mileage * 0.055 * numberOfEngines; return mileage; } From bf9dd459de2425fb9e4d1cda6a9a24073192aa69 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 22:11:20 -0400 Subject: [PATCH 19/30] Added function definitions Contains constructor, destructor, toString(), and estimatedMileage() --- Skateboard.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Skateboard.cpp b/Skateboard.cpp index e69de29b..542f6458 100644 --- a/Skateboard.cpp +++ b/Skateboard.cpp @@ -0,0 +1,37 @@ +//Created by Nicholas Watts on Oct 4, 2019 +//Function definitions are based on those in Bicycle.cpp except +//where otherwise annotated. + +#include "Skateboard.h" + +Skateboard::Skateboard(string brand, string model) +{ + setBrand(brand); + setModel(model); +} + +Skateboard::~Skateboard() = default; + +//This function determines the mileage based on the implementation outlined +//in the assignment pdf. The mileage is somewhere between 0.1 and 0.5 miles +//per minute, and an additional amount of minutes if the time is between +//25 and 250 minutes. +double Skateboard::mileageEstimate(double time) +{ + srand(time(0)); + int addition = 0; + double mileage = rand()%5 + 1.0; + mileage *= 0.1 * time; + if (time > 25 && time < 250) + { + addition = rand()%(time/3); + addition += 1; + mileage += addition; + } + return mileage; +} + +string Skateboard::toString() +{ + return "-> Skateboard\n" + Vehicle::toString(); +} From 2a378ef601b0f59b1dd063bb150fd8893fad7061 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 22:22:26 -0400 Subject: [PATCH 20/30] Added function prototypes Include: constructor, destructor, toString, accessor and mutator for private member numberCylinders, and mileageEstimator --- Monorail.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Monorail.h b/Monorail.h index e69de29b..a269860b 100644 --- a/Monorail.h +++ b/Monorail.h @@ -0,0 +1,24 @@ +//Created by Nicholas Watts on March 4, 2019 + +#ifndef DRIVINGSIMULATOR_MONORAIL_H +#define DRIVINGSIMULATOR_MONORAIL_H + +#include "PoweredVehicle.h" + +class Monorail: public PoweredVehicle +{ + + private: + int numberCylinders; + + public: + Monorail(); + explicit Monorail(string brand, string model, string fuelType = "diesal", + int numCyl = 6); + int getNumberCyl(); + void setNumberCyl(int newNum); + virtual double mileageEstimate(double time); + virtual string toString(); +}; + +#endif From 18892a8150f65493216332c715365edd463bfa11 Mon Sep 17 00:00:00 2001 From: NickWattsCS Date: Fri, 4 Oct 2019 22:41:44 -0400 Subject: [PATCH 21/30] Included