Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Bicycle.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Created by Esteban Parra on 9/5/19.
// Created by Kristen Davis
//

#ifndef DRIVINGSIMULATOR_BICYCLE_H
Expand All @@ -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();
Expand Down
51 changes: 51 additions & 0 deletions Jet.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
//Kristen Davis
//
#include <cstdlib>
#include <ctime>
#include "Jet.h"

Jet::Jet() {
myEngineSize = "unknown";
setBrand("Custom");
setModel("VTx");
setNumberofEngines(1);
}

Jet::Jet(string brand, string model, string fuelType, int numberOfEngines=1) {
setBrand(brand);
setModel(model);
setFuelType(fuelType);
//setEngineSize(engineSize);
setNumberofEngines(numberOfEngines)
}

Jet::~Jet() = default;

string Jet::getNumberofEngines() {
return numberOfEngines;
}

void Jet::setFuelType(string fuelType) {
fuel=fuelType
}

}

double Jet::mileageEstimate(double time) {
double mileage = (rand()%(100-40)+40) * time;
if (fuelType == "rocket" && numberOfEngines>=2) {
mileage += mileage * (0.055);
}
return mileage;
}

string Jet::toString() {
return "-> Jet\n" + PoweredVehicle::toString() + "\n\tEngine Size: " +
getNumberofEngines();

void Jet::setNumberofEngines(int ne)
{
numEngines=ne;
}
}
31 changes: 31 additions & 0 deletions Jet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Created by Esteban Parra on 9/5/19.
//

#ifndef DRIVINGSIMULATOR_JET_H
#define DRIVINGSIMULATOR_JET_H

#include "PoweredVehicle.h"

class Jet : public PoweredVehicle {

private:
string fuel;
int numEngines;

public:
Jet();

explicit Jet(string brand, string model, string fuelType,
string engineSize, int numberOfEngines);

virtual ~Jet();
string getNumberofEngines();
void setFuelType(string engineSize);
virtual double mileageEstimate(double time);
virtual string toString();
void setNumberofEngines(int ne);
};


#endif //DRIVINGSIMULATOR_CAR_H
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name: Kristen Davis
FSUID: knd15e
41 changes: 41 additions & 0 deletions Skateboard.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
//Kristen Davis
//
#include <random>
#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) {
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;
mileage+=(rand()%(high-1)+1);
}
return mileage;
}

string Skateboard::toString() {
string s = "-> Skateboard\n\t";
return "-> Skateboard\n" + Vehicle::toString() + "\nWheels: " +
to_string(numberofwheels);
}
27 changes: 27 additions & 0 deletions Skateboard.h
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions docs/answers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
e.a) On branch master
Your branch is up to date with 'origin/master'.

e.b) git shortlog
17

e.c) git log --follow .gitignore

Date: Wed Sep 25 18:13:30 2019 -0400

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) 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.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.
3 changes: 3 additions & 0 deletions docs/status.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
On branch master
Your branch is up to date with 'origin/master'.

11 changes: 8 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#include <iostream>
#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];

Expand All @@ -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
Expand All @@ -37,4 +42,4 @@ void printVehiclesRoster(Vehicle **vehicles, int size) {
<< vehicles[i]->mileageEstimate(simulatedDistance) << " miles in "
<< simulatedDistance << " seconds" << endl;
}
}
}
56 changes: 56 additions & 0 deletions tank.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
//Kristen Davis
//
#include <cstdlib>
#include <ctime>
#include "Tank.h"

Tank::Tank() {
nickname="Company X"
setMisson("Training");
camoflauge="desert";
setnumberofGuns(2);
}

Tank::Tank(string camo, string n,string m, int num=2) {
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;
}
31 changes: 31 additions & 0 deletions tank.h
Original file line number Diff line number Diff line change
@@ -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