This is pseudocode that I wish to checked for errors and advice in general. It is supposed to ask a user if they want to Add(afterward it will show them their total bill) or drop(will tell them drop complete when completed) a class or see their schedule(will show the average student amount and student amount in each classes)
Student Bill Calculator
Module main ()
Declare integer ID, classA,
Declare real hoursW, Total
Call ScheduleSetup
Call EnterStudentID
Call PromptUser
End Module
Module ScheduleSetup
Declare string Classes[5]
Declare integer ClassSeats[5]
Set Classes[5] = ENG111, SDV100, ITP100, ITN200, PSY200
Return Classes[5]
Set ClassSeats[5] = 24, 13, 19, 8, 17
Return ClassSeats[5]
End Module
Module EnterStudentID
Display "Input Student ID"
Return ID
End Module
Module PromptUser
Declare integer choice
Display "Type 1 if you wish to add a class, Type 2 if you wish to drop a class, or type 3 if you wish to see your schedule and class information"
Prompt User to input 1,2, or 3
If(choice=1)
Call AddAClass
If(choice=2)
Call DropAClass
If(choice=3)
Call Schedule
End Module
Function AddAClass
Set classA = 0
answer = input ("Would you like to register for another class?")
While (answer == "YES")
Display "If customer add 3 classes, they receive 1 of them for free, what is the name of the class you would like to take"
classA = classA + 1
continue loop
EndWhile(answer =="NO")
Display "How many hours do you work per week"
Input hoursW
IF (hoursW > 20 AND classA > 2)
Display "Speak to your advisor"
Endif(hoursW < 20 OR classA <3)
if (classA = 3)
Set Total = (classA-1) \*150\*1.05
Else
Set Total = (classA)\*150\*1.05
Display "Your Student ID is" ID "and your current class Total is" Total
End Function
Function DropAClass
answer = input ("Would you like to drop a class?")
While (answer == "YES" or "yes")
Display "Enter the name of the class you wish to drop"
classA = classA-1
If(classA<0)
Display "Error"
EndIf
EndWhile (answer == "NO" or "no")
Display "Class Drop Complete"
End Function
Module Schedule
Declare integer average
Display "You have" classA "classes selected"
Show User the number of seats for their selected classes in the order chosen
Add the chosen classes number of seats then divide by classA
Display "The average number of students in your classes is" average
End Module
What I have tried:
Can a module be called in another module. Also how would I connect two arrays ex. person chose class[3] and they will be automatically showed classcount[3]