You are on page 1of 4

While Loop

Declare
Mem_Name, Mem_ID : Array[1..9]of string
Locate : Array,Train_ID : [1..9] of string
Mem_Code , Tol_sessions, Subtotal : Array[1..9] of integer
Dis_count, Fin_cost, Fin_costJMD : Array[1..9] of real
Andrew_total, Michelle_total, Kevin_total, :hley_total : real
Total_discount : real
Ans : char
Train_ID Array[1..9] : string
y : integer
Mem_fee : real
Train_Fname : string
Usage_fee : real
GCT : real

Begin
Total_discount = 0.0
Andrew_total = 0.0
Michelle_total = 0.0
Kevin_total = 0.0
:hley_total = 0.0
Y=0

For x = 1 to 9 DO
Begin
Subtotal [y] = 0
Dis_count[y] = 0.0
Fin_cost[y] = 0.0
Fin_costJMD [y] = 0.0
End for

Writeln(’ Enter Non to begin entering or Less to close’


Readln( Ans
While Ans <> ‘Non’ Do
y=y+1

Writeln(‘Enter the Member’s ID’


Readln( Mem_ID[y]
Writeln(’Enter the Full Name’
Readln( Mem_Name[y]
Writeln(’ Enter the Membership Code’
Readln( Mem_Code[y]
Writeln(’ Enter the Trainers ID’
Readln( Train_ID[y]
Writeln(’ Enter the Location’
While Loop
Readln( Locate[y]
Writeln(’ Enter Total Sessions’
Readln( Tol_sessions[y]
If Mem_Code[y] = ‘STU’ then
Mem_fee = 45.75
Else
If Mem_Code[y] = ‘CSV’ then
Mem_fee = 75.75
Else
If Mem_Code[y] = ‘PRV’ then
Mem_fee = 100.00
Else
Mem_fee = 200.00

End if
End if
End if

If Train_ID = ‘AF242’ then


Train_Fname = ‘AndrewForrester’
Else
If Train_ID = ‘MP454’ then
Train_Fname= ‘Michelle Palmer’
Else
If Train_ID = ‘KR721’ then
Train_Fname= ‘Kevin Roberts’
Else
Train_Fname =‘:hley Fowler’

End if
End if
End if
Usage_ fee = tol_sessions [y] * 4.75
Subtotal [x] = Mem_fee + Usage_fee
If(Mem_Code[y]’STU’ AND tol_sessions[y] > 12 then
Dis_count[y]= subtotal [y] * 0.05
Else
If(Mem_Code[y] ‘PRV’ tol_sessions[y] > 20 then
Dis_count[y]= Mem_fee * 0.03
Else
Dis_count[y] = 0.0
End if
End if

GCT = Subtotal[y] * 0.105


Fin_cost [y] = (Sub_total [y] + GCT) – dis_count[y]
While Loop
Fin_costJMD [y] = Fin_cost [y] * 128.25

If Train_ID[y] = ‘AF242’ then


Andrew_total = Andrew_total +Fin_cost [y]
Else
If Train_ID[y] = ‘MP454’then
Michelle_total = Michelle_total +Fin_cost [y]
Else
If Train_ID[y] = ‘KR721’then
Kevin_total = Kevin_total +Fin_cost [y]
Else
:hley Fowler = :hley Fowler +Fin_cost [y]
End if
End if
End if

Total_discount = Total_discount + Dis_count[y]


Writeln(’ Enter Non to begin entering or Less to close’
Readln( Ans

ENDWHILE
Writeln( ‘Name: | ID | Location | Sessions | Subtotal | Discount | Final Cost | Fnal Cost JMD’
For y = 1 to 9 DO
Begin
Writeln( Mem_Name[y] ,Mem_ID[y],
Writeln( ‘Membership Code:’, Mem_Code[y]
Writeln( ‘Location:’,Locate[y]
Writeln( ‘Total Sessions:’,Tol_ sessions[y]
Writeln( ‘Subtotal:’,Subtotal[y]
Writeln( ‘Discount:’,Dis_count[y]
Writeln( ‘Final Cost:’,Fin_cost[y]
Writeln( ‘Final Cost JMD:’,Fin_costJMD[y]
End for
Writeln( ‘SUMMARY’
Writeln( ‘Total Discount:’,Total_discount
Writeln( ‘Andrew Forrester:’, Andrew_total
Writeln( ‘Michelle Palmer:’, Michelle_total
Writeln( ‘Kevin Roberts:’, Kevin_total =
Writeln( ‘:hley Fowler:’, :hley_total
END
While Loop

You might also like