Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- int main()
- {
- //This is my heading of a rickshaw advertising "ODUSports"
- cout << "******************************************************************" << endl;
- cout << "********************************____________________**************" << endl;
- cout << "*******************************/ |///////////)*************" << endl;
- cout << "*****************************/ |//ODUSPORTS/)************" << endl;
- cout << "*********()()()************/ |/////////////)***********" << endl;
- cout << "***_____()()()()_________/______________|//////////////)__********" << endl;
- cout << "***(////////////////////|///////////////|///////////////|_|>~~~~~*" << endl;
- cout << "***(////////////////////|///////////////|///////////////|_|>~~~~~*" << endl;
- cout << "****(/////ODUSPORTS/////|///ODUSPORTS///////ODUSPORTS//_|_|>~~~~~*" << endl;
- cout << "*****(//////////////////|/////////////////////////////)***********" << endl;
- cout << "******(__()()()()_______|___________/ ()()()()()()()_)************" << endl;
- cout << "********() ()*******************() () ()*************" << endl;
- cout << "********() () ()*******************() () () () ()*************" << endl;
- cout << "********() ()*******************() () ()*************" << endl;
- cout << "*********()()()()*********************()()()()()()()**************" << endl;
- cout << "******************************************************************" << endl;
- //* Steps to my program
- //(1) Declare some variables to work with
- char fare;
- char choice='Y';
- int hrIn, minIn, hrOut, minOut;
- int hours,
- minutes,
- total_minutes,
- additionalTime;
- double cost1,
- cost2,
- cost3,
- cost4;
- //(2) Declare some constant variables to work with
- const double chargeS = 7.00;
- const double chargeC = 10.50;
- const double chargeG = 16.00;
- while(choice=='Y'||choice=='y'){
- //(3) This clears the screen and starts over
- system("CLS");
- cout << "******************************************************************" << endl;
- cout << "********************************____________________**************" << endl;
- cout << "*******************************/ |///////////)*************" << endl;
- cout << "*****************************/ |//ODUSPORTS/)************" << endl;
- cout << "*********()()()************/ |/////////////)***********" << endl;
- cout << "***_____()()()()_________/______________|//////////////)__********" << endl;
- cout << "***(////////////////////|///////////////|///////////////|_|>~~~~~*" << endl;
- cout << "***(////////////////////|///////////////|///////////////|_|>~~~~~*" << endl;
- cout << "****(/////ODUSPORTS/////|///ODUSPORTS///////ODUSPORTS//_|_|>~~~~~*" << endl;
- cout << "*****(//////////////////|/////////////////////////////)***********" << endl;
- cout << "******(__()()()()_______|___________/ ()()()()()()()_)************" << endl;
- cout << "********() ()*******************() () ()*************" << endl;
- cout << "********() () ()*******************() () () () ()*************" << endl;
- cout << "********() ()*******************() () ()*************" << endl;
- cout << "*********()()()()*********************()()()()()()()**************" << endl;
- cout << "******************************************************************" << endl;
- //(4) Output read info and user message
- cout << "\nThis program will calculate a single, couple, or group "
- << "\nfare amount which is then owed by the customer for the trip.\n"
- << "\nTo calculate a single fare amount, input S (or s)"
- << "\nTo calculate a couple fare amount, input C (or c)"
- << "\nTo calculate a group fare amount, input G (or g)"
- << " \n\nInput S, C, or G: ";
- cin >> fare;
- // end of description
- //--------------------------------------------------------------------------------
- //(5) This begins the S if and else statements
- if(fare=='S'||fare=='s'){
- cout << "\nWhat hour did the single customer depart? ";
- cin >> hrOut;
- cout << "\nWhat minute did the single customer depart? ";
- cin >> minOut;
- cout << "\nYou entered for departure: " << hrOut << ":" << minOut << endl;
- cout << "\nWhat hour did the single customer arrive? ";
- cin >> hrIn;
- cout << "\nWhat minute did the single customer arrive? ";
- cin >> minIn;
- cout << "\nYou entered for arrival: " << hrIn << ":" << minIn << "\n" << endl;
- cout << "A rickshaw departed at " << hrOut << ":" << minOut
- << " and arrived at " << hrIn << ":" << minIn << " with a single customer.\n" << endl;
- if(hrIn < hrOut && minIn <= minOut){
- hours = (hrIn - hrOut) + 23;
- cout << "The single customer arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut) + 60;
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- else if(hrOut < hrIn && minOut <= minIn){
- hours = (hrIn - hrOut);
- cout << "The single customer arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut);
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- //-----------------------------------------------------//(6) Different if and else but apart of S if
- else if(hrIn < hrOut && minOut <= minIn){
- hours = (hrIn - hrOut) + 24;
- cout << "The single customer arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut);
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- else if(hrOut < hrIn && minIn <= minOut){
- hours = (hrIn - hrOut) - 1;
- cout << "The single customer arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut) + 60;
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- //-----------------------------------------------------//(7) Different if and else but apart of S if
- else if(hrIn <= hrOut && minOut <= minIn){
- hours = (hrIn - hrOut);
- cout << "The single customer arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut);
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- if(total_minutes <=30){
- cout << fixed << showpoint << setprecision(2);
- cout << "The single customer will pay $" << chargeS << " dollars.\n" << endl;
- }
- else{
- additionalTime = total_minutes - 30;
- cout << "The single customer will be charged for " << additionalTime << " extra minute(s).\n" << endl;
- cost1 = chargeS + (((total_minutes) - 30) * 1.50);
- cout << fixed << showpoint << setprecision(2);
- cout << "The single customer will pay $" << cost1 << " dollars.\n" << endl;
- }
- }
- //(8) End of S if
- //--------------------------------------------------------------------------------
- //(9) This begins the C if and else statements
- else if(fare=='C'||fare=='c'){
- cout << "\nWhat hour did the couple depart? ";
- cin >> hrOut;
- cout << "\nWhat minute did the couple depart? ";
- cin >> minOut;
- cout << "\nYou entered for departure: " << hrOut << ":" << minOut << endl;
- cout << "\nWhat hour did the couple arrive? ";
- cin >> hrIn;
- cout << "\nWhat minute did the couple arrive? ";
- cin >> minIn;
- cout << "\nYou entered for arrival: " << hrIn << ":" << minIn << "\n" << endl;
- cout << "A rickshaw departed at " << hrOut << ":" << minOut
- << " and arrived at " << hrIn << ":" << minIn << " with a couple of customers.\n" << endl;
- if(hrIn < hrOut && minIn <= minOut){
- hours = (hrIn - hrOut) + 23;
- cout << "The couple arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut) + 60;
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- else if(hrOut < hrIn && minOut <= minIn){
- hours = (hrIn - hrOut);
- cout << "The couple arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut);
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- //-----------------------------------------------------//(10) Different if and else but apart of C if
- else if(hrIn < hrOut && minOut <= minIn){
- hours = (hrIn - hrOut) + 24;
- cout << "The couple arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut);
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- else if(hrOut < hrIn && minIn <= minOut){
- hours = (hrIn - hrOut) - 1;
- cout << "The couple arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut) + 60;
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- //-----------------------------------------------------//(11) Different if and else but apart of C if
- else if(hrIn <= hrOut && minOut <= minIn){
- hours = (hrIn - hrOut);
- cout << "The couple arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut);
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- if(total_minutes <=20){
- cout << fixed << showpoint << setprecision(2);
- cout << "The couple will pay $" << chargeC << " dollars.\n" << endl;
- }
- else{
- additionalTime = total_minutes - 20;
- cout << "The couple will be charged for " << additionalTime << " extra minute(s).\n" << endl;
- cout << fixed << showpoint << setprecision(2);
- cost2 = chargeC + (((total_minutes) - 20) * 2.50);
- cout << "The couple will pay $" << cost2 << " dollars.\n" << endl;
- }
- }
- //(12) End of C if
- //--------------------------------------------------------------------------------
- else if(fare=='G'||fare=='g'){
- cout << "\nWhat hour did the group of customers depart? ";
- cin >> hrOut;
- cout << "\nWhat minute did the group of customers depart? ";
- cin >> minOut;
- cout << "\nYou entered for departure: " << hrOut << ":" << minOut << endl;
- cout << "\nWhat hour did the group of customers arrive? ";
- cin >> hrIn;
- cout << "\nWhat minute did the group of customers arrive? ";
- cin >> minIn;
- cout << "\nYou entered for arrival: " << hrIn << ":" << minIn << "\n" << endl;
- cout << "A rickshaw departed at " << hrOut << ":" << minOut
- << " and arrived at " << hrIn << ":" << minIn << " with a group of customers.\n" << endl;
- if(hrIn < hrOut && minIn <= minOut){
- hours = (hrIn - hrOut) + 23;
- cout << "The group of customers arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut) + 60;
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- else if(hrOut < hrIn && minOut <= minIn){
- hours = (hrIn - hrOut);
- cout << "The group of customers arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut);
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- //-----------------------------------------------------//(13) Different if and else but apart of G if
- else if(hrIn < hrOut && minOut <= minIn){
- hours = (hrIn - hrOut) + 24;
- cout << "The group of customers arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut);
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- else if(hrOut < hrIn && minIn <= minOut){
- hours = (hrIn - hrOut) - 1;
- cout << "The group of customers arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut) + 60;
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- //-----------------------------------------------------//(14) Different if and else but apart of G if
- else if(hrIn <= hrOut && minOut <= minIn){
- hours = (hrIn - hrOut);
- cout << "The group of customers arrived in " << hours << " hour(s)";
- minutes = (minIn - minOut);
- cout << " and " << minutes << " minute(s)";
- total_minutes = (hours * 60) + minutes;
- cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
- }
- if(total_minutes <=15){
- cout << fixed << showpoint << setprecision(2);
- cout << "The group of customers will pay $" << chargeG << " dollars.\n" << endl;
- }
- if(total_minutes > 15 && total_minutes <=30 ){
- additionalTime = total_minutes - 15;
- cout << "The group of customer will be charged for " << additionalTime << " extra minute(s).\n" << endl;
- cout << fixed << showpoint << setprecision(2);
- cost3 = chargeG + (((total_minutes) - 15) * 4.00);
- cout << "The group of customers will pay $" << cost3 << " dollars.\n" << endl;
- }
- if(total_minutes > 30){
- additionalTime = total_minutes - 15;
- cout << "The group customers will be charged for " << additionalTime << " extra minute(s).\n" << endl;
- cout << "The group customers will also be charged an additional $50.00 fee for exceeding the time of 30 minutes.\n" << endl;
- cout << fixed << showpoint << setprecision(2);
- cost4 = chargeG + (((total_minutes) - 15) * 4.00) + 50;
- cout << "Which brings the group of customer's total amount of $" << cost4 << " dollars.\n" << endl;
- }
- }
- //(15) End of G if
- //--------------------------------------------------------------------------------
- else{
- cout << "\nThe character that you have entered was invalid! Please try again!\n" << endl;
- }
- cout << "Would you like to perform another calculation (Y/N)? ";
- cin >> choice;
- }
- //(16) This is my termintation message!
- cout << "\nI am quite surprised that you are leaving my program so soon,\n"
- << "but I will thank you anyways for using my ODUSPORTS calculator!\n" << endl;
- cout << " TTTTTTT H H A N N K K SSSS !! " << endl;
- cout << " T H H A A NN N K K S !! " << endl;
- cout << " T HHHH AAAAA N N N KK SSSS !! " << endl;
- cout << " T H H A A N NN K K S " << endl;
- cout << " T H H A A N N K K SSSS !! " << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement