Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that asks the user for survey data about Muni riders, and output

ID: 3644495 • Letter: W

Question

Write a program that asks the user for survey data about Muni riders, and outputs a summary of that data. Your program should first ask the user which Muni street car line was surveyed, use a character to store the answer. Then the program asks the user how many days the survey was conducted, storing an integer answer, and then the number of riders that were counted (also an int). Your program divides the number of riders by the number of days and outputs the resulting average daily ridership. If that average is not a whole number, make sure you show the decimal value (such as in the examples below). You should use a typecast to make this work.

Please follow input/output exactly and do not forget

Standard Input
K
5
123456

Standard Output
Welcome to the Muni Ridership Calculator.
Which Muni line did you survey?
How many days did you survey it?
How many people riders did you count?

According to your survey, an average of 24691.20 people rode the K-line per day.

Standard Input
N
30
250000

Standard Output
Welcome to the Muni Ridership Calculator.
Which Muni line did you survey?
How many days did you survey it?
How many people riders did you count?

According to your survey, an average of 8333.33 people rode the N-line per day.

Standard Input
L
22
10

Standard Output
Welcome to the Muni Ridership Calculator.
Which Muni line did you survey?
How many days did you survey it?
How many people riders did you count?

According to your survey, an average of 0.45 people rode the L-line per day.

Standard Input
F
31
1200000

Standard Output
Welcome to the Muni Ridership Calculator.
Which Muni line did you survey?
How many days did you survey it?
How many people riders did you count?

According to your survey, an average of 38709.68 people rode the F-line per day.

Explanation / Answer

Please rate...

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
    int a,c;
    char b;
    float r;
    cout<<"Welcome to the Muni Ridership Calculator. ";
    cout<<"Which Muni line did you survey? ";
    cin>>b;
    cout<<"How many days did you survey it? ";
    cin>>a;
    cout<<"How many people riders did you count? ";
    cin>>c;
    cout<<" ";
    r=(float)c/a;
    cout<<"According to your survey, an average of ";
    cout<<fixed<<setprecision(2)<<r;
    cout<<" people rode the ";
    cout<<b<<"-line per day. ";
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote