Question
Lab 5.5 Bring in program study.cpp . Modify the program so that it also finds the average number of hours per day the students study
Lab 5.5
Bring in program study.cpp. Modify the program so that it also finds the average number of hours per day the students study biology as well as programming. Include two prompts, one for each subject. Have the program print out which subject the students, on average, spent the most time on.
Copy and paste your C++ code into your report when done.
Lab 5.6 Student Generated Code Assignment
Write a program that prompts the user for the number of tellers at Nations Bank in Hyattsville. For each worker the program should ask for the number of days that worker was out sick for the last year. The output should provide the number of tellers and the total number of days missed by all the tellers.
See the sample output below.
How many tellers worked at Nation's Bank last year?
3
How many sick days was teller 1 out for, during the last year ?
2
How many sick days was teller 2 out for, during the last year ?
4
How many sick days was teller 3 out for, during the last year ?
7
The 3 tellers were out sick for a total of 13 days during the last year.
Copy and paste your C++ code into your report when done.
Turn in your lab report when finished with all exercises.
study.cpp:
// This program finds the average time spent programming by a student // each day over a three day period.
// PLACE YOUR NAME HERE
#include "pch.h" #include
int main() {
float numHours, average; int numStudents; float total = 0;
cout << "This program will find the average number of hours" << " that students spent programming over a weekend" << endl << endl; cout << "How many students are there?" << endl; cin >> numStudents;
for (int student = 1; student <= numStudents; student++) { cout << endl << "Please enter the number of hours worked by student " << student << " over the weekend." << endl; cin >> numHours;
total = total + numHours; }
average = total / numStudents;
cout << endl; cout << "The average number of hours per day spent programming by " << "the students was " << average << endl << endl << endl;
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started