Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Highway {
- public :
- string IsCrash();
- double WhatTime() ;
- double GetTime();
- private:
- double militaryTime;
- double timeOfDay;
- string crash;
- };
- class Driver {
- public:
- double TripEta();
- private:
- double tripDistance;
- double driversMph;
- double totalDistance;
- };
- string Highway::IsCrash() {
- cout << "I see you if you are wondering it is ok to take the highway right now." << endl << "Was there a crash? (Y/N?)" << endl;
- cin >> crash;
- return crash;
- }
- double Highway::WhatTime () {
- cout << "Futhermore, what time of day is it?" << endl << "Enter in military time format" << "(Ex. 0.30 = 12:30 midnight, 1.00 = 1:00am, etc.)" << endl;
- cin >> militaryTime;
- return militaryTime;
- }
- double Highway::GetTime() {
- militaryTime = timeOfDay;
- return timeOfDay;
- }
- double Driver::TripEta() {
- cout << "How many miles is the trip?" << endl;
- cin >> tripDistance;
- cout << "How many miles are you going per hour?" << endl;
- cin >> driversMph;
- totalDistance = (tripDistance / driversMph) * 60;
- return totalDistance;
- }
- int main()
- {
- Highway crash;
- Highway timeOfDay;
- Driver tripInMiles;
- if ( (crash.IsCrash() == "Y" && tripInMiles.TripEta() > 60.0) || (timeOfDay.GetTime() >= 7.30 && timeOfDay.GetTime() <= 8.30) )
- {
- cout << "It is advised to avoid the highway, find an alternate route." << endl;
- }
- else {
- cout << "It is determined it is efficient " << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement