Answered step by step
Verified Expert Solution
Question
1 Approved Answer
5. Write a program that finds the average number of hours per day that a given student studies programming as well as chemistry. For each
5. Write a program that finds the average number of hours per day that a given student studies programming as well as chemistry. For each given student include two prompts, one for each subject. Have the program print out which subject the student, on average, spent the most time on. This program will find the average number of hours a day each given student spent on programming and on chemistry over a long weekend How many students are there? 3 Enter the number of days in the long weekend: 2 Enter student 1 day 1 programming hrs: 3 Enter student 1 day 1 chemistry hrs: 2 Enter student 1 day 2 programming hrs: 2 Enter student 1 day 2 chemistry hrs: 1 The average number of hours per day spent programming by student 1 is 2.5 The average number of hours per day spent chemistry by student 1 is 1.5 This student averaged more time on programming. Enter student 2 day 1 programming hrs: 1 Enter student 2 day 1 chemistry hrs: 2 Enter student 2 day 2 programming hrs: 1 Enter student 2 day 2 chemistry hrs: 3 The average number of hours per day spent programming by student 2 is 1.0 The average number of hours per day spent chemistry by student 2 is 2.5 This student averaged more time on chemistry. Enter student 3 day 1 programming hrs: 1 Enter student 3 day 1 chemistry hrs: 1 Enter student 3 day 2 programming hrs: 1 Enter student 3 day 2 chemistry hrs: 1 The average number of hours per day spent programming by student 3 is 1.0 The average number of hours per day spent chemistry by student 3 is 1.0 This student spent the same amount of time on both subjects. Note that the inner loop of this program is executed n times-once for each day of the long weekend. Here, n is a positive integer input by the user. In other words, the user decides how many days to consider just as they choose how many students to consider
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