/*
  Craig Persiko
  CS 110A
  Solution to Practice Problem 3 - Muni Ridership Calculator
  Objective: To perform a simple calculation based on user input
*/

#include <iostream>
using namespace std;

int main()
{
  int number_riders, num_days;
  char muni_name[51];

  cout << "Welcome to the Muni Ridership Calculator.\n";
  cout << "Which Muni line did you survey?  ";
  cin >> muni_name;
  cout << "How many days did you survey it?  ";
  cin >> num_days;
  cout << "How many riders did you count?  ";
  cin >> number_riders;

  cout << "According to your survey, an average of "
       << number_riders/static_cast<double>(num_days)
       << " people\nrode the " << muni_name << " per day.\n";
  // The static_cast above is necessary to get a decimal answer
  // (not one with the fractional part cut off)

  return 0;
}

/*
Compilation and Sample Output on Hills:

[cpersiko@hills ~]$ g++ pp3.cpp
[cpersiko@hills ~]$ a.out
Welcome to the Muni Ridership Calculator.
Which Muni line did you survey?  K-Ingelside
How many days did you survey it?  5
How many riders did you count?  123456
According to your survey, an average of 24691.2 people
rode the K-Ingelside per day.
[cpersiko@hills ~]$ a.out
Welcome to the Muni Ridership Calculator.
Which Muni line did you survey?  N-Judah
How many days did you survey it?  30
How many riders did you count?  250000
According to your survey, an average of 8333.33 people
rode the N-Judah per day.
[cpersiko@hills ~]$ 

*/



syntax highlighted by Code2HTML, v. 0.9