Anda di halaman 1dari 5

Header This should accept input from the user and make calculations, and output the information in

a summary and a table

Declare Const

regfee = 500

T1 = 1550

T2 = 2500

T3 = 3000

MG01 = 0.80

MS02 = 0.70

WD03 = 0.75

NN04 = 0

check:string

patient:array[1..40] as string

regnum:array[1..40] as string

parish:array[1..40] as string

centretype:array[1..40] as integer

company:array[1..40] as string

bloodtest:array[1..40] as string

bloodtestamt:array[1..40] as integer

surcharge:array[1..40] as real

bloodtesttotal:array[1..40] as real

docfee:array[1..40] as integer

inaltotal:array[1..40] as real

insuranceamt:array[1..40] as real

patamt:array[1..40] as real

count,pbellosumpatients,irishsumpatients,queenssumpatients,fairysumpatients  integer

pbellosum,irishsum,queenssum,fairysum real

Begin

count  0

Print
Print ('Enter the Registration Number of the patient or No to Exit')

readln(check)

IF check <> 'No' then

Repeat

Begin

count  count + 1

regnum[count]  check

Print

Print ('Enter the name of the patient')

Read(patient[count])

Print ('Enter the parish of the patient. queenssumland, PortaBello, irishsumTown or


fairysumland')

Read(parish[count])

Print ('Enter the health centre type that the patient attended')

Print ('Enter 1 for T1 , 2 for T2 and 3 for T3')

Read(centretype[count])

If centretype[count] = 1 then

docfee[count]  T1

If centretype[count] = 2 then

docfee[count]  T2

If centretype[count] = 3 then

docfee[count]  T3

Print ('Enter the name of the insurance company or "none" if the patient wasnt
insured')

Read(company[count])

Print ('Did the patient conduct a blood check? Type Y for yes or N for No ')

Read(bloodtest[count])
If bloodtest[count] = 'Y' then

bloodtestamt[count]  950

ELSE

bloodtestamt[count]  0

surcharge[count]  bloodtestamt[count]*0.1

bloodtesttotal[count]  bloodtestamt[count] + surcharge[count]

finaltotal[count]  regfee + bloodtestamt[count] + surcharge[count] + docfee[count]

If company[count] = 'Magicor' then

insuranceamt[count]  docfee[count] * MG01

If company[count] = 'Medisure' then

insuranceamt[count]  docfee[count] * MS02

If company[count] = 'Warden' then

insuranceamt[count]  docfee[count] * WD03

If company[count] = 'none' then

insuranceamt[count]  docfee[count] * NN04

patamt[count]  finaltotal[count] - insuranceamt[count]

IF parish[count] = 'Portabello' then

Begin

pbellosumpatients  pbellosumpatients + 1

pbellosum  pbellosum + finaltotal[count]

End

IF parish[count] = 'queenssumland' then

Begin

queenssumpatients  queenssumpatients + 1

queenssum  queenssum + finaltotal[count]

End

IF parish[count] = 'irishsum Town' then

Begin

irishsumpatients  irishsumpatients + 1
irishsum  irishsum + finaltotal[count]

End

IF parish[count] = 'fairysumland' then

Begin

fairysumpatients  fairysumpatients + 1

fairysum  fairysum + finaltotal[count] End

Print

Print ('Enter the Registration Number of the patient or No to Exit')

Read(check)

End

Until check = 'No'

IF patient[1] <> 'No' then

Begin

Print

Print ('In Summary')

Print ('There were ',pbellosumpatients,' patients from Portabello')

Print ('Patients from Portabello totalled $',pbellosum:0:2)

Print ('There were ',queenssumpatients,' patients from queenssumland')

Print ('Patients from queenssumland totalled $',queenssum:0:2)

Print ('There were ',fairysumpatients,' patients from fairysumland')

Print ('Patients from fairysumland totalled $',fairysum:0:2)

Print ('There were ',irishsumpatients,' patients from irishsum Town') Print ('Patients
from irishsum Town totalled $',irishsum:0:2)

Print

Print ('Registration Number':20, 'Name of the Patient':25, 'Parish':15, 'Cost of Blood


check':25, 'Total':10, 'Insurance Amt':15, 'Patient Amt':15)

For count  1 to count do

Print (regnum[count]:20, patient[count]:25, parish[count]:15, bloodtesttotal[count]:25:2,


finaltotal[count]:10:2, insuranceamt[count]:15:2, patamt[count]:15:2)

End
If check = 'END' then

Print

Print ('The Program will now Exit')

Read

End.

Anda mungkin juga menyukai