Homework 9: Yet More Loops

Wednesday, April 04, 2012     


[Up] [Previous Homework] [Next Homework]


Complete the following:

Solution

  1. NOTE: You need to start indenting your programs properly. Points will be taken off for not indenting this homework appropriately
  2. Reminder to look at CMSC104 Indentation Standards
  3. Create a new file called hw09.c
  4. You are going to create a program that will calculate your current class grade
  5. Ask the user to input the number of classwork assignments turned in so far
  6. Ask the user to input the number of homework assignments turned in so far
  7. Ask the user to input the number of quizzes completed so far
  8. Ask the user to input whether the final has been completed or not
  9. Then loop over the set of assignments, asking for the grade earned for each assignment
  10. NOTE: unlike homework 4, you are asking for each individual homework and classwork grade now, not just the classwork and homework averages
  11. Once the grade for all assignmenets have been entered, calculate the overall class GPA so far and display it
  12. 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.
  13. 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.
  14. Think about how you can calculate the average without having to store each individual grade
  15. 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
    

  16. You can verify the output of your calculations using grade center
  17. Create a script of you running your program twice.
  18. Once you are done, use submit to submit two files, hw09.c and typescript

    linux3[1]% submit cs104_sheets hw09 hw09.c typescript