Help with GPA Calculator
Oct 8, 2016 at 6:16pm UTC
My teacher wants me to write a program without using arrays. it has to include functions and read % write to file.
the problem specification is to calculate the average of each student and also calculate to mean average for the class. also to find the student id with highest average and the student id with lowest average
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
This is the algorithm.
Initialize
studcount = 0
sumavgs = 0.0
max avg = -10000.0
minavg = 10000.0
print " Dr Whiz Programmer's Class Report"
print " Semester Average"
print " Summer 2000"
print "Class GPA Average Grade"
print " Class GPA Average Grade"
print "Enter student Number, class and gpa:"
Get studnum, class , GPA
while (studnum != -1
Begin
print "studnum"
if (class == 1)
print "Freshman"
if (class == 2)
print "sophomore"
if (class == 3)
print "Junior"
if (class == 4)
print "Senior"
if (class == 5)
print "Graduate"
print " GPA "
count = 0
sum = 0
while (count <= 3)
Begin
Get "avg"
sum = sum + avg
count = count + 1
End
studavg = sum/count
sumavgs = sumavgs + studavg
print "studavg"
if (studavg >= 90)
grade = 'A'
else if (studavg >= 80)
grade = 'B'
else if (studavg >= 70)
grade = 'C'
else if (studavg >=60)
grade = 'D'
else grade = 'F'
print "grade"
studcount = studcount + 1
if (studavg > maxavg)
Begin
max avg = studavg
hiID = studnum
End
if (studavg < minavg)
Begin
minavg = studavg
lowID = studnum
End
Get Studnum, class , GPA
End
meanavg= sumavgs/studcount
print "Mean average is " , meanavg
print "The Student with Highest average is " , hiID
print "The Student with Lowest average is " , lowID
End
Oct 8, 2016 at 6:24pm UTC
You have been given a lovely pseudo-code, whats the problem now? Try to convert it to c++ style code and if you have a problem we all are here...
Topic archived. No new replies allowed.