Looping Problem with If/Then/Else Design an algorithm to input student records;
ID: 3850048 • Letter: L
Question
Looping Problem with If/Then/Else
Design an algorithm to input student records; each record contains a student name, registration code, and credits field. A registration code of 1 indicates that the student is a resident. A registration code of 2 indicates that the student is a nonresident. A value of 12 or more in the credits field indicates full-time (FT) status. A lesser value indicates part-time (PT) status. Output a detail line for each student containing the student’s name and a tuition amount computed as follow:
FT resident $1200.00 flat fee
PT resident $ 100 per credit
FT nonresident $2760.00 flat fee
PT nonresident $230.00 per credit
Five total lines are also to be output as follows:
Total number of FT resident students
Total number of PT resident students
Total number of FT nonresident students
Total number of PT nonresident students
Total number of students
Use automatic end-of-file logic to signal the end of the input.
Explanation / Answer
Algorithm: The below mentioned is the algorithm of your requirement. Please mention if you want pseudo code. I will provide that too. As for now think this is enough for you.
start
declare resident student count, nonresident student count, parttime student count, fulltime student count
while 1
start loop
read student record as user input press '1' to exit
if user input is 1
then
break
end if
else
then
enter student name, registration code, credit fields
if registration code equals 1
then
the student is a resident
increment resident student count
end if
else
then
the student is a non resident
increment nonresident student count
end else
if credit field greater than or equals 12
then
student has a full time status
increment fulltime student code
end if
else then
student has a parttime status
increment parttime student count
end else
print fulltime student count + resident student count
print parttime student count + resident student count
print fulltime student count + nonresident student count
print parttime student count + nonresident student count
print fulltime student count + resident student count+parttime student count + nonresident student count
end else
end while
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.