// File: prog2_3simple.cpp
// Prompt the user for the time a movie starts and the length of the  movie. 
// Determine when the movie ends. 
// A bus always arrives in front of the theater at 22:45. 
// Compute the waiting time at the bus stop. 
// Output the time the movie ends and the waiting time
// Use the simple Time24 implementation

#include <iostream>
#include "simpletime24.h"

using namespace std;

int main()
{
   Time24 startMovie, movieLength, endMovie,
          busArrival(22,45), waitingTime;

   // prompt and input times for movie to start and its length
   cout << "Enter the time the movie starts and its length: ";
   startMovie.ReadTime(cin);
   movieLength.ReadTime(cin);

   // compute the time the movie ends and the waiting time for the bus
   endMovie = startMovie;
   endMovie.AddTime(movieLength.GetHour()*60+movieLength.GetMinute());
   waitingTime = Time24(0, (busArrival.GetHour()*60+busArrival.GetMinute())
                        - (endMovie.GetHour()*60+endMovie.GetMinute()));

   cout << "Movie ends at ";
   endMovie.WriteTime(cout);
   cout << endl;
   cout << "Waiting time for the bus is ";
   waitingTime.WriteTime(cout);
   cout << endl;

   return 0;
}  // end main
