diff --git a/.README.md.un~ b/.README.md.un~ new file mode 100644 index 00000000..4b9c29c9 Binary files /dev/null and b/.README.md.un~ differ diff --git a/Jet.cpp b/Jet.cpp new file mode 100644 index 00000000..bf38f517 --- /dev/null +++ b/Jet.cpp @@ -0,0 +1,43 @@ +// +// Created by Andres Paz +// +#include "Jet.h" + +//default constructor +Jet::Jet(string brand, string model, string fuelType, int numEngines) { + setBrand(brand); + setModel(model); + setFuelType(fuelType); + setNumberOfEngines(numEngines); +} + +//set function +void Jet::setNumberOfEngines(int numEngines) { + numberOfEngines = numEngines; +} + +//get function +int Jet::getNumberOfEngines() { + return numberOfEngines; +} +//deconstructor +Jet::~Jet() = default; + +//needed help implementing this +//Jet message +string Jet::toString() { + return "-> Jet\n" + PoweredVehicle::toString() + "\n\tNumber of engines: " + + to_string( getNumberOfEngines() ); +} + +//needed help implementing this +//mileage estimate -- creates a random num (40-100) and updates milage based on credentials +double Jet::mileageEstimate(double time) { + int r = rand() % 60+40; + double mileage = r * time; + if ( getNumberOfEngines() > 2 && fuelType == "Rocket" ) + { + mileage += mileage * ( 5.5 * getNumberOfEngines() ); + } + return mileage; +} diff --git a/Jet.h b/Jet.h new file mode 100644 index 00000000..29dca64b --- /dev/null +++ b/Jet.h @@ -0,0 +1,28 @@ +// +// Created by Andres Paz +// +#ifndef DRIVINGSIMULATOR_JET_H +#define DRIVINGSIMULATOR_JET_H + +#include "PoweredVehicle.h" +#include "Vehicle.h" + +class Jet : public PoweredVehicle { + +public: + explicit Jet(string brand, string model, int numberOfEngines = 1); + + virtual ~Jet(); + int getEngineCount(); + void setEngineCount(int gearCount); + int getEngineCount(); + + virtual string toString(); + virtual ~Jet(); + virtual double mileageEstimate(double time); +private: + int numberOfEngines; +}; + + +#endif diff --git a/README.md b/README.md index e69de29b..28abbb86 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,2 @@ +Name: Andres Paz Vicca +FSUID: aap17e diff --git a/README.md~ b/README.md~ new file mode 100644 index 00000000..a3d6c002 --- /dev/null +++ b/README.md~ @@ -0,0 +1,2 @@ +Name: Andres Paz Vicca +FSUID: AAP17E diff --git a/Skateboard.h b/Skateboard.h new file mode 100644 index 00000000..ef53bad5 --- /dev/null +++ b/Skateboard.h @@ -0,0 +1,21 @@ +// +// Created by Andres Paz +// +#ifndef DRIVINGSIMULATOR_SKATEBOARD_H +#define DRIVINGSIMULATOR_SKATEBOARD_H + +#include "Vehicle.h" + +class Skateboard : public Vehicle { + +public: + explicit Skateboard(string brand, string model); + + + virtual string toString(); + virtual double mileageEstimate(double time); + virtual ~Skateboard(); +}; + + +#endif diff --git a/Veoride.cpp b/Veoride.cpp new file mode 100644 index 00000000..afd49e94 --- /dev/null +++ b/Veoride.cpp @@ -0,0 +1,33 @@ +// +// Created by Andres Paz +// +#include "Veoride.h" + +Veoride::~Veoride() = default; + +//default constructor +Veoride::Veoride(string brand, string model, string fuelType) { + setBrand(brand); + setModel(model); + setFuelType(fuelType); +} +//default construtor +Veoride::Veoride() { + setBrand("Cheapy"); + setModel("30mph"); + setFuelType("manpower/electric"); +} + + +double Veoride::mileageEstimate(double time) { + double mileage = 5 * time; + if ( fuelType == "manpower/electric" ) + { + mileage += mileage * 3; + } + return mileage; +} + +string Veoride::toString() { + return "-> Veoride\n" + PoweredVehicle::toString(); +} diff --git a/Veoride.h b/Veoride.h new file mode 100644 index 00000000..e9ab2f29 --- /dev/null +++ b/Veoride.h @@ -0,0 +1,25 @@ +// +// Created by Andres Paz +// +#ifndef DRIVINGSIMULATOR_VEORIDE_H +#define DRIVINGSIMULATOR_VEORIDE_H + +#include "PoweredVehicle.h" + +#include +#include + +class Scooter : public PoweredVehicle { + +public: + Veoride(); + + explicit Veoride(string brand, string model, string fuelType); + + virtual ~Veoride(); + virtual double mileageEstimate(double time); + virtual string toString(); +}; + + +#endif diff --git a/docs/answers.txt.txt b/docs/answers.txt.txt new file mode 100644 index 00000000..24885e3a --- /dev/null +++ b/docs/answers.txt.txt @@ -0,0 +1,72 @@ +a) +$ git push +Enumerating objects: 12, done. +Counting objects: 100% (12/12), done. +Delta compression using up to 4 threads +Compressing objects: 100% (7/7), done. +Writing objects: 100% (10/10), 992 bytes | 82.00 KiB/s, done. +Total 10 (delta 2), reused 0 (delta 0) +remote: Resolving deltas: 100% (2/2), completed with 1 local object. +To https://github.com/aap17e/assignment2.git + ebf1259..80c2e60 master -> master + +b) +$ git shortlog -s + 6 Esteban Parra + 5 aap17e +=11 commits in total + +c) +$ git log -- .gitignore + +Date: Wed Sep 25 18:13:30 2019 -0400 + +d) +Makes sure your code changes are verified before delivering them to other developers +-Support quality assurance/code quality/integration/testing processes +-Better support for developers working in parallel + +e) +The git log command displays committed snapshots. It lets you list the project history, filter it, and search for specific changes. +While git status lets you inspect the working directory and the staging area, git log only operates on the committed history. + +f) +git log --follow -- vehicle.h + + +g) + +git log --grep=file + +h) + +Inheritance is the mechanism of basing an object or class upon another object or class while +retaining similar implementation. + +Polymorphism is a programming language's ability to process objects differently depending on +their data type or class. More specifically, it is the ability to redefine methods for derived classes + +Encapsulation describes the idea of bundling data and methods that work on that data within one unit + +i) Dictator and Lieutenants Workflow: ******Distributed development and integration.******8 +One central/blessed repository:Everyone makes pull from this repository. Only the dictator can push to it. +•Dictator repository: Merges changes in the lieutenant repositories and solves any arising conflicts. +•Lieutenant repositories: Merges changes for some (not all) developers and solves conflicts. A developer +pushes changes to the assigned lieutenant repository. + +Integration Manager WorkflowFrom: Each developer makes push to his/her own public repository, +and pull from the blessed/central repository. +Two repositories per developer(Public/private) +Integration conflict resolution are done by the integration manager. +(Centralized integration)Each developer makes pull and push to his/her own public repository. + +j) + +A team of developers would benefit from the Dictator and Lieutenants workflow since they can all commit their +changes to the same repository and solve any arising conflicts, the final product is clean since only the +dictator can push to it + +Object Oriented Question) +It uses both encapsulation and polymorphism. + +The simulater is using encapsulation by having classes that encompass functions and by separating the member data and functions into different levels of protection. On the other hand, virtual functions are being used in the vehicle and powered vehicle classes so it has polymorphism. the common function name serves the purpose of polymorphism diff --git a/docs/status.txt.txt b/docs/status.txt.txt new file mode 100644 index 00000000..dfcb9bdd --- /dev/null +++ b/docs/status.txt.txt @@ -0,0 +1,5 @@ +On branch master +Your branch is ahead of 'origin/master' by 1 commit. + (use "git push" to publish your local commits) + +nothing to commit, working tree clean