Problem solving and programming
Omega Dublin, tyron clake , zach quammie,
ayanna o’garro, latresa te
Bishop Collage kingstown
150015
[Link] and the grenadines
Problem Statement
The clinic wants me to read the names of an unspecified number of patients, gender, status,
weight, cost of visit; I must count the number of females over 200 lbs, total cost of visits
and display the list of children who visited the clinic for the past month.
Declaration of variables
female_count-integer- used to record the number of females weighing over 200 lbs
total_c-integer- used to calculate the total cost of all visits cost_visit-
integer- used to record the cost of visit weight-integer- used to record the
weight of the patient child-integer- used to record the number of children i-
integer- used in the array display the names of the children stat-char- used
to record the status of the patient gen-char- used to record the gender of the
patient name-string- used to record the name of the patient
names:array[1..10] of string-string- used to record the names of the children
Initialization of
variables female_count←0
child←0 total_c←0 FOR i:=1 TO 10
DO names [i]:= name
ENDFOR
Processing
Start
Write “Enter the name”
read name
WHILE name <> “ “ DO
write “Enter the gender
M/F'” read gen write
“Enter the status C/A” read
stat write “Enter the weight”
read weight write “Enter the
cost of visit” read cost_visit
IF gen= “F” AND weight >200 THEN
female_count←female_count+1
ENDIF IF stat= 'C' THEN child
←child + 1 names[child] ← name
ENDIF total_c←
total_c+cost_visit
Write “ Enter the patient name or a blank to end the program”
read name
ENDWHILE
write “The number of female patients weighing over 200 lbs is “, female_count,”,”,”and the
total cost of all visits is $”,total_c
write “ There was/were “,child,”child/children who visited the clinic over the past month”
write “These are the names of the children”
FOR i =1 TO child DO
write names[i]
ENDFOR
End Processing
Data For trace table
First Name Last Name Gender Status Weight Cost of Visit
James Thompson M A 210 $220.00
Sandy Brown F A 190 $270.00
Deron Davis M C 110 $400.00
Savannah George F A 210 $470.00
Gooba Theron M C 194 $200.00
Rollon Hunt M C 198
$250.00
Eve Rammer F A 145 $420.00
Uniee Tuzuku M A 223 $320.00
Wendy Antry F c 215 $450.00
veden ferry M C 140 $200.00