Problem: Given the file of class 2B, write the equivalent pseudocode that will:
1.) compute the individual average (composed of the periodical test score, quizzes, class standing) of all the students in the given file.
2.) Count and print the number of students whose average is 95 and above.
3.) compute and print the class average.
CA= (sum of all averages) / (# of students)
**ONE psseudocode and flowchart for all 3 questions.
Here is my pseudocode
CN=1
AVE=0
CA=0
C=1
TA=0
READ Q,PT,CS
While CN%26lt;=39
AVE=(Q+PT+CS)/3
write AVE
if AVE%26gt;=95
C=C+1
else
write C
Endif
TA=AVE+TA
Write TA
ENDDO
CA=TA/39
Write CA
END
Is my turbo c pseudocode correct?
Count = 0
Over95Count = 0
TotalAverage = 0
OPEN File
WHILE File NOT EMPTY
READ Q, PT, CS
/* the READ has to be in the WHILE to read all the data */
Count = Count + 1 /* count the students */
Average = ( Q + PT + CS ) / 3
WRITE "Student Average: ", Average
IF Average %26gt;= 95
Over95Count = Over95Count + 1
END IF
TotalAverage = TotalAverage + Average
END WHILE
WRITE "Average 95 or Higher: ", Over95Count
WRITE "Class Average: ', TotalAverage / Count
CLOSE File
END
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment