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
74 changes: 74 additions & 0 deletions Jet.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//
// Created by Taylor Driver on 10/3/2019
//


#include "Jet.h"
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <random>

Jet::Jet() {
myEngineSize = "unknown";
myEngineNum = 1;
setBrand("Custom");
setModel("V6");
}

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;
}

int 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(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<int> uni(40,100);
int randnum = uni(rng);
double mileage = randnum * time;

if(fuelType == "Rocket" && myEngineNum == 2)
mileage = mileage + 5.5;

return mileage;
}


string Jet::toString() {
return "-> Jet\n" + PoweredVehicle::toString() + "\n\tEngine Size: " + getEngineSize();
}
30 changes: 30 additions & 0 deletions Jet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// Created by Taylor Driver on 9/5/19
//

#ifndef DRIVINGSIMULATOR_JET_H
#define DRIVINGSIMULATOR_JET_H

#include "PoweredVehicle.h"

class Jet : public PoweredVehicle {

private:
int myEngineNum;
string myEngineSize;

public:
Jet();

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

virtual ~Jet();
string getEngineSize();
int getEngineNum();
void setEngineSize(string engineSize);
void setEngineNum(int engineNum);
virtual double mileageEstimate(double time);
virtual string toString();
};

#endif //DRIVINGSIMULATOR_JET_H
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name: Taylor Driver
FSUID: trd16
74 changes: 74 additions & 0 deletions RollerCoaster.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//
// Created by Taylor Driver on 10/3/19
//

#include "RollerCoaster.h"

RollerCoaster::RollerCoaster() {
myEngineSize = "unknown";
myManufacturer = "unknown";
myName = "unknown";
myModel = "unknown";
}

RollerCoaster::RollerCoaster(string manufacturer, string name, string model, string fuelType, string engineSize) {
setManufacturer(manufacturer);
setName(name);
setModel(model);
setFuelType(fuelType);
setEngineSize(engineSize);
}


RollerCoaster::~RollerCoaster() = default;

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")
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;

if(myModel == "Wooden")
double mileage = time * ((rand() % 72-4) + 5);


return mileage;
}


string RollerCoaster::toString() {
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();
}
35 changes: 35 additions & 0 deletions RollerCoaster.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Created by Taylor Driver on 10/3/19
//

#ifndef DRIVINGSIMULATOR_ROLLERCOASTER_H
#define DRIVINGSIMULATOR_ROLLERCOASTER_H

#include "PoweredVehicle.h"

class RollerCoaster : public PoweredVehicle {

private:
string myEngineSize;
string myManufacturer;
string myName;
string myModel;
public:
RollerCoaster();

explicit RollerCoaster(string manufacturer, string name, string model, string fuelType, string engineSize);

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();
};

#endif //DRIVINGSIMULATOR_ROLLERCOASTER_H
44 changes: 44 additions & 0 deletions Skateboard.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
//Created by Taylor Driver on 10/3/19
//

#include "Skateboard.h"
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <cmath>
#include <random>

Skateboard::Skateboard(string brand, string model) {
setBrand(brand);
setModel(model);
}

Skateboard::~Skateboard() = default;

double Skateboard::mileageEstimate(double time) {
//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<double> 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<double> dist(0.1,time/3);
mileage = mileage + dist(rng);
}
}

string Skateboard::toString() {
string s = "-> Skateboard\n\t";
return "-> Skateboard\n" + Vehicle::toString();


}
23 changes: 23 additions & 0 deletions Skateboard.h
Original file line number Diff line number Diff line change
@@ -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

78 changes: 78 additions & 0 deletions docs/answers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//
// Taylor Driver created on 10/4/2019
//


4.
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.


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.
Empty file added docs/status.txt
Empty file.
Loading