How to write a student grade book

HI! Im having trouble trying to figure out how to write a program that can calculate just one student's grade. My professor gave me some pseudo-code to help me figure out how to set it up, but im still having trouble figuring out how to set it up. Here is the problem:

The program will work for one student. It will need to take as input the student's name. The user will then be asked to input grades into three categories in this order:

1) homework

2) quizzes

3) tests



The grades in a given category will be averaged to one number that is the average of all grades in that category. The final average will be the weighted average of each category, where homework is worth 25%, quizzes are worth 25%, and test are worth 50%. Like this:



Homework Grades: 65, 70, 75, 80, 80 Homework Average: 74

Quiz Grades: 75, 80, 85, 80. Quiz Average: 80

Test Grades: 75, 80, 85, 75 Test Average: 78.75



Final Average = 0.25*HomeworkAvg + 0.25*QuizAvg + 0.50*TestAvg = 77.87



The sequence of input and output will be exactly this:



1. Print a menu with these choices:
1) Average grades for a new student;

2) Quit



2. If the user enters “1”, ask for the student’s name:

3. The user enters the student's name



4. Print instructions telling the user the order the grades will be entered in and what to enter to indicate that there are no more grades to enter for that category.



5. For each category print what category of grade they are entering then the user is repeatedly prompted to enter a grade and this keeps going until a “-1” is entered.



6. Once the user has entered a “-1” for a category move on to the next category.



7. Once grades have been entered for all three categories, the student’s name and current average is printed to the screen.



8. Repeat steps 1 through 6 until the user enters “2” at the main menu to indicate that the user has no more students to grade, and the program should terminate.



Program Structure



In the last assignment you were given pseudo-code to follow. In this assignment you will have to do a little more thinking for yourself. Below is an overview of the things you will need in your program.



1. Declare any variables that will be needed for the program. You generally want to declare variables close to where you intend to use them, while being aware that if you declare them in a code block, they will be scoped to that code block only.



2. Create a loop that will repeatedly execute steps 3 to 10 of this program structure, until the quit option is chosen.



3. Print the main menu as described above



4. Ask for the students name and store it in a variable



5. Print the instructions to the screen



6. Create a loop asking the user for the next homework grade.



7. Inside the loop you will need to add the entered grade to a running total



8. Increment a counter tracking the number of grades entered for that category.



9. After the loop calculate the average for that category



10. Create two similar loops, as steps 6 to 9 one each for quizzes and tests



11. After all three category loops, calculate the final average using the weighting formula above



12. Print the student's name and the newly calculated final average for that student



13. The loop created in step 2 should loop over steps 3 to 12 until the user enters a 2 when prompted by the main menu.



I will greatly appreciate just an understanding of how to actually approach this. Thanks!
I'm not sure what I can add to the steps that have already been laid out there. I guess I'd start with pen and paper and sketch out what information I need to store in variables as the program goes along. And it sounds like you could use a while loop with a sentinel value (-1) to determine when to break out of the loop.
are you going to show any actual code?
Topic archived. No new replies allowed.