Find AND correct the six error in the following pseudo coda program. Circle the
ID: 3829828 • Letter: F
Question
Find AND correct the six error in the following pseudo coda program. Circle the bad code and write the correct code next to your circle. The problem should print rightarrow the total number of females with a certificate rightarrow the total number of people with l year of college rightarrow the total number of people with 2 years of college rightarrow the total number of people with a certificate rightarrow the average age of all the females The input consists of the rightarrow age rightarrow gender (1 = male and 2 = female) rightarrow rightarrow certificate (l = yes, 2 = no, 0 = end of file) You should: rightarrow Circle ONLY statements that contain LOGIC errors. rightarrow Next to the circled statement, provide the correct LOGICExplanation / Answer
Start
sumfemaleswithcertificate = 0
sumfemales = 0
totaloneyear = 0
totaltwoyears = 0
totalcertificate = 0
totalage = 0
Read age, gender, collegeyears, certificate
DOWhile certificate is not equal to 0
IF gender = 2 THEN
sumfemales = sumfemales + 1
totalage = totalge + age
ENDIF
IF collegeyears = 1 THEN
totaloneyear = totaloneyear + 1
ELSE
IF collegeyear = 2 THEN
totaltwoyears = totaltwoyears + 1
ENDIF
ENDIF
if certificate = 1 THEN
totalcertificate = totalcertificate +1
if gender = 2 THEN
sumfemaleswithcertificate = sumfemaleswithcertificate + 1
ENDIF
ENDIF
Read age, gender, collegeyears, certificate
ENDDO
averagefemales = totalage/sumfemales
write sumfemaleswithcertificate, totaloneyear, totaltwoyears, totalcertificate, averagefemales
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.