# (Solved) : Cos1511 103 2 2019 Question 3a Outer Loop Controls Number Students Note Inner Loop Program Q39838328 . . .

$9.00

COS1511/103/2/2019 QUESTION 3a The outer loop controls the number of students. Note that the inner loop of this program is always executed exactly three times, once for each day of the long weekend. Modify the code so that the inner loop iterates times, where n is a positive integer that the user inputs. Thus, the users decide how many days to consider just as they choose how many students to consider A sample run: This program will find the average number of hours a day that a student spent programming over a long weekend: How many students are there? Enter the number of days in the long weekend Please enter the number of hours worked by student i on day 1 Please enter the number of hours worked by student i on day 2 The average number of hours per day spent programming by student lis 5 Please enter the number of hours worked by student 2 on day 1 Please enter the number of hours worked by student 2 on day 2 The average number of hours per day spent programming by student 2 is 11 QUESTION 3b Modify question.cpp so that it also finds the average number of hours per day that a given student studies biology as well as programming. For each given student include two prompts, one for each subject. Have the program display which subject the student, on average, spend the most time on Submit: question.cpp output (15 marks) Show transcribed image text COS1511/103/2/2019 QUESTION 3a The outer loop controls the number of students. Note that the inner loop of this program is always executed exactly three times, once for each day of the long weekend. Modify the code so that the inner loop iterates times, where n is a positive integer that the user inputs. Thus, the users decide how many days to consider just as they choose how many students to consider A sample run: This program will find the average number of hours a day that a student spent programming over a long weekend: How many students are there? Enter the number of days in the long weekend Please enter the number of hours worked by student i on day 1 Please enter the number of hours worked by student i on day 2 The average number of hours per day spent programming by student lis 5 Please enter the number of hours worked by student 2 on day 1 Please enter the number of hours worked by student 2 on day 2 The average number of hours per day spent programming by student 2 is 11 QUESTION 3b Modify question.cpp so that it also finds the average number of hours per day that a given student studies biology as well as programming. For each given student include two prompts, one for each subject. Have the program display which subject the student, on average, spend the most time on Submit: question.cpp output (15 marks)

## Expert Answer

Answer to COS1511/103/2/2019 QUESTION 3a The outer loop controls the number of students. Note that the inner loop of this program …