Homework 9: Yet More Loops
Wednesday, April 04, 2012[Up] [Previous Homework] [Next Homework]
Complete the following:
- NOTE: You need to start indenting your programs properly. Points will be taken off for not indenting this homework appropriately
- Reminder to look at CMSC104 Indentation Standards
- Create a new file called hw09.c
- You are going to create a program that will calculate your current class grade
- Ask the user to input the number of classwork assignments turned in so far
- Ask the user to input the number of homework assignments turned in so far
- Ask the user to input the number of quizzes completed so far
- Ask the user to input whether the final has been completed or not
- Then loop over the set of assignments, asking for the grade earned for each assignment
- NOTE: unlike homework 4, you are asking for each individual homework and classwork grade now, not just the classwork and homework averages
- Once the grade for all assignmenets have been entered, calculate the overall class GPA so far and display it
- Note: When calculating the GPA so far, use the percentages from the syllabus of 30% for the final, 30% for quizzes, 24% for homework, and 16% for classwork.
- Note: If the final hasn't been completed, then use the percentsage of 30%/70% for quizzes, 24%/70% for homework, and 16%/70% for classwork, that will provide a total of 100% excluding the final.
- Think about how you can calculate the average without having to store each individual grade
- Example run:
How many homeworks have been completed: 3 Home many classworks have been completed: 4 Home many quizzes have been completed: 2 Enter 1 if the final has been completed: 0 Enter homework 1 grade: 90 Enter homework 2 grade: 95 Enter homework 3 grade: 95 Enter classwork 1 grade: 20 Enter classwork 2 grade: 100 Enter classwork 3 grade: 100 Enter classwork 4 grade: 75 Enter quiz 1 grade: 90 Enter quiz 2 grade: 90 Your total GPA is: 89.1
- You can verify the output of your calculations using grade center
- Create a script of you running your program twice.
- Once you are done, use submit to submit two files, hw09.c and typescript
linux3[1]% submit cs104_sheets hw09 hw09.c typescript