2. (Check the note below before writing your code.) Write a program that asks the user for the number of students (e.g., 2) and the number of tests per student (e.g., 3). Note: The number of tests is not different from one student to another. It then asks for all the test scores for one student (by iterating once for each test score), calculates the average score for that student and displays it. It then switches to next student and repeats receiving the scores, calculating the average, and displaying it. Since we have not yet learned about arrays in C++, do not use any array. Do not forget to validate the inputs received from the user. Select the best type of loop for input validation.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
2. Please provide the correct C++ code that works with Visual studio for the following question ت
2. (Check the note below before writing your code.) Write a program that asks the user for
the number of students (e.g., 2) and the number of tests per student (e.g., 3). Note: The
number of tests is not different from one student to another. It then asks for all the test
scores for one student (by iterating once for each test score), calculates the average
score for that student and displays it. It then switches to next student and repeats
receiving the scores, calculating the average, and displaying it.
Since we have not yet learned about arrays in C++, do not use any array.
Do not forget to validate the inputs received from the user. Select the best type of loop
for input validation.
Below is a sample run of this code:
How many students do you have?
2
How many tests per student do you have?
3
Enter test 1 score for student 1 : 90
Enter test 2 score for student 1: 80
Enter test 3 score for student 1 : 70
The average score for student 1 is 80
Enter test 1 score for
student 2 : 76
Enter test 2 score for student 2: 87.5
Enter test 3 score for student 2: 55
The average score for student 2 is 72.8333
Note: Break your code into small parts. Write one part and run it. If it works correctly,
add a new part to your code. For example: first write a code that has only one student in
the class and calculates the exams average for that student. If it works correctly, modify
it so it can handle more than one student. If the code works perfectly, add input
validations.
Transcribed Image Text:2. (Check the note below before writing your code.) Write a program that asks the user for the number of students (e.g., 2) and the number of tests per student (e.g., 3). Note: The number of tests is not different from one student to another. It then asks for all the test scores for one student (by iterating once for each test score), calculates the average score for that student and displays it. It then switches to next student and repeats receiving the scores, calculating the average, and displaying it. Since we have not yet learned about arrays in C++, do not use any array. Do not forget to validate the inputs received from the user. Select the best type of loop for input validation. Below is a sample run of this code: How many students do you have? 2 How many tests per student do you have? 3 Enter test 1 score for student 1 : 90 Enter test 2 score for student 1: 80 Enter test 3 score for student 1 : 70 The average score for student 1 is 80 Enter test 1 score for student 2 : 76 Enter test 2 score for student 2: 87.5 Enter test 3 score for student 2: 55 The average score for student 2 is 72.8333 Note: Break your code into small parts. Write one part and run it. If it works correctly, add a new part to your code. For example: first write a code that has only one student in the class and calculates the exams average for that student. If it works correctly, modify it so it can handle more than one student. If the code works perfectly, add input validations.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY