Professional Documents
Culture Documents
PseudoCode and FlowChart Examples
PseudoCode and FlowChart Examples
Write a flowchart and pseudocode to calculate the student’s final grade. The Final Grade
consists of the average of the grades of four exams (sum of each exam grade divided by 4).
The student passes the course if his final grade is above 65. The program should ask for the
grades of the four exams and write as output:
The value of the final grade
Pass if the student passed the exam
Fail if the student failed the exam
Pseudocode:
Begin
End
Flowchart:
Begin
Grade і (exam1+exam2+exam3+exam4)/4
Yes No
Grade > 65
End
Given the above pseudocode, Fill the table for the examples below for these 2 students:
Student1
- Exam1 = 75, Exam2=60 Exam3=82 Exam4=78
Student2
- Exam1 = 65, Exam2=57 Exam3=62 Exam4=70
2
Question #3
Write a flowchart and pseudocode to calculate a student’s tuition fee. The program should
take as input the student’s Name, ID, and number of credits
If Number of credits >=16, tuition is a flat fee of $3,000
If Number of credits >=10, each credit will cost $200
If Number of credits <10, each credit will cost $250
The program should write as output the student’s Name, ID and Tuition. The program should
execute for 20 students. The program should calculate the total tuition paid by all students
(only for pseudocode)
Pseudocode:
Begin
Count = 1
Total_Tuition=0
While (count<=20)
(
Output “Please Enter the student’s name, ID and Number of credits”
Input Name, ID, Credits
If (Credits >=16)
Tuition=3000
else if (Credits>=10)
Tuition=200*Credits
else
Tuition=250*Credits
endif
Output “Student Name:”, Name
Output “Student ID:”, ID
Output “Student Tuition:”, Tuition
Count=count+1
Total_Tuition = Total_Tuition + Tuition
)
Print “The Total Tuition paid by all students is”, Total_Tuition
End
3
Flowchart:
Begin
No
Count<=20
Yes
Yes
Credits>=16
Tuition і 3000
No
Yes
Credits>=10
Count і Count+1
4
Question #4
Pseudocode:
Begin
Int Length, Width, Perimeter
Print (“Please enter the Length and Width of the rectangle”)
Perimeter = 2*(Length + Width)
If (Perimeter is greater than 100)
Print (“Huge Perimeter”)
Else
Print (“Small Perimeter”)
Stop
http://www.dyclassroom.com/flowchart/exercise-1
http://www.dyclassroom.com/flowchart/exercise-2