But the question doesn't allow me to use this statement more than once: Enter an integer.
It only allows: Enter the integers: a b c ...
This is the question:
"When calculating the grade of a course, we usually need to take into account the scores achieved by the student in both 1) the written assignments and, 2) the various exams.
In this lab you are asked to implement a Course Grade Calculator program that takes as input the scores of a student in both the assignments and the exams and outputs the grade achieved by the student in the course.
To achieve this purpose, you need to know how it is possible to calculate the grade in a course given the different scores. To facilitate the development of the program, we can make the following assumptions:
Both types of scores can range from 0 (lowest) to 100 (highest).
The student has handed assignmentNumber assignments and taken examNumber exams. For assignments, we can compute the corresponding average value by adding all the assignment scores and then dividing them by the number of assignments. Similarly for exams. Let us call the two average values assignmentAvg and examAvg respectively.
The relative importance of each score is determined by the weight of the score. In our scenario, all assignment scores have the same weight, called assignmentWeight, and all exams have also the same equal weight, called examWeight. The ratio between the two weights is an indicator of how important assignments are compared to exams. For instance, if the assignments have weight 1 and exams have weight 2, then that suggests that exam scores are twice as important as assignment scores, when calculating the grade.
The total score, denoted as totalScore, can be computed by the weighted average of the assignment and the exam scores. Concretely, if assignmentAvg and examAvg are the average of the assignment and exam scores respectively, then totalScore can be computed using the formula:
totalScore =
(assignmentWeight*assignmentAvg + examWeight*examAvg)/
(assignmentWeight + examWeight)
After the calculation of the total score, we distinguish between the following cases:
If totalScore is between 90 and 100 (90 inclusive), then the grade is A.
If totalScore is between 80 and 90 (80 inclusive), then the grade is B.
If totalScore is between 70 and 80 (70 inclusive), then the grade is C.
If totalScore is between 60 and 70 (60 inclusive), then the grade is D.
If totalScore is below 60, then the grade is F.
Input and Output Specifications
Input
Give the number of assignments: assignmentNumber
Give the number of exams: examNumber
Give the weight of assignments: assignmentWeight
Give the weight of exams: examWeight
Give the score of the assignmentNumber assignments: score_1 ... score_n (separated by spaces)
Give the score of the examNumber exams: score_1 ... score_k (separated by spaces)
Output
The grade of this course is: grade
Do you want to calculate the grade of another course? (y/n) option
Valid range for all scores is 0 to 100, while the weights have to be positive numbers. Also, you do NOT have to check whether the input data are valid or not. We assume that all inputted data are valid.
A skeleton file and a sample program are provided for your reference. "
The sample is:
http://course.cse.ust.hk/comp102/Info/Ron/fall09/lab4/img/Execute2.jpg