Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Question #1

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

Output “Enter the student’s exam grades”


Input exam1, exam2, exam3, exam4
grade=(exam1+exam2+exam3+exam4)/4
if (grade>65)
Output “Grade =”, grade
Output “Pass”
else
Output “Grade =”, grade
Output “Fail”
Endif

End

Flowchart:

Begin

Input exam1, exam2, exam3, exam4

Grade і (exam1+exam2+exam3+exam4)/4

Yes No
Grade > 65

Print grade Print grade


Print “Pass”
Print ͞Fail͟ Print ͞Fail͟

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

Exam1 Exam2 Exam3 Exam4 Grade Output


75 60 82 78 74 74
Pass
65 57 62 70 64 64
Fail

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

Input Name, ID, Credits End

Yes
Credits>=16

Tuition і 3000
No

Yes
Credits>=10

Tuition і 200 * Credits


No

Tuition і 250 * Credits

Print ͞Student Name:͟Name


Print ͞Student ID:͟ID
Print ͞Student Tuition:͟Tuition

Count і Count+1

4
Question #4

Find the perimeter of a rectangle, knowing that:


Perimeter = 2*(Length + Width)
Length and Width should be entered as inputs.
If the Perimeter is greater than 100 display the following message:
“Huge Perimeter”
Otherwise display the following message:
“Small Perimeter”

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

Links to More Examples;

http://www.dyclassroom.com/flowchart/exercise-1
http://www.dyclassroom.com/flowchart/exercise-2

You might also like