/* Craig Persiko
   busses.cpp
   Solution to In-class exercise: You're planning a wedding, 
   and you need to transport all your wedding guests from 
   the ceremony to the reception. A bus can carry 40 passengers. 
   Please use a named constant for this value. Your program should 
   ask the user how many guests are expected, and it should output 
   how many busses are needed, and the number of extra people you 
   could carry with those busses.
*/

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
  const int BUS_CAPACITY = 40;
  int numGuests, numBusses;
  

  cout << "Please enter the number of guests: ";
  cin >> numGuests;

  numBusses = ceil(static_cast<double>(numGuests)/BUS_CAPACITY);
  cout << "You will need " << numBusses << " busses.\n";

  cout << "You have space for " << numBusses * BUS_CAPACITY - numGuests 
       << " extra guests.\n";

  return 0;
}

/* Compilation and Sample Output on Linux:

[cpersiko@milhouse ~]$ g++ busses.cpp
[cpersiko@milhouse ~]$ ./a.out
Please enter the number of guests: 80
You will need 2 busses.
You have space for 0 extra guests.
[cpersiko@milhouse ~]$ ./a.out
Please enter the number of guests: 70
You will need 2 busses.
You have space for 10 extra guests.
[cpersiko@milhouse ~]$

*/



syntax highlighted by Code2HTML, v. 0.9