Week 6Overview This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, analysis, test plan, design and implementation with C code. The example provided uses sequential, repetition statements and nested repetition statements.Program DescriptionThis program will calculate the average of 3 exams for 5 students. The program will ask the user to enter 5 student names. For each of the students, the program will ask for 3 exam scores. The average exam score for each student will be calculated and printed.InteractionStarting with this project, the interactions between the program and the user are getting complicated enough to justify a new section before the Analysis section a section which will eventually become the Users Guide. This section is a rather detailed presentation of how the program and the user will interact. A little reflection should make it apparent that neither the Analysis nor the Test Plan can really proceed without an understanding of how the program will work from the users perspective.At the moment, the exact interaction is not defined by the Program Description, so this is our chance to make that interaction clear and convenient, and we will make choices. In this case, we choose to enter the 3 numbers, followed by a name. There should be spaces between the numbers and the between the third number and the students name. For this program, we will allow all the information to be on a single line. Here is an example, the prompt in black, the user input in red:Enter 3 grades and the students name: 88.76 93 98.22 Mary
Page 2 of 9
AnalysisNew concept: reading, storing and printing a string input from the user. This is going to require research or an example.Required storage: float data: new grade, sum of grades, average of those grades string data: students nameMath: sum = sum + new grade average = sum / 3Example of one student: input: 70 80 90 Jane sum = 0 sum = sum + 70 sum = sum + 80 sum = sum + 90 sum is 240 at this point average = 240 / 3 = 80Output for one student Average for Jane is 80Looping: for 5 students o reset sum o for 3 grades get grades o get name o compute average o print result for one student end for 5 students
Reviews
There are no reviews yet.