Find AND correct the six in the following coda program. Circle the bad code and
ID: 3829842 • Letter: F
Question
Find AND correct the six in the following coda program. Circle the bad code and write the correct coda red to your circle. The problem should print the total number of females with a certificate the total number of people with 1 year college the total number of people with 2 years of collage the total number of people with a the average age of all the females The input consists of the age gender (1 = male and 2 female) college years (1 = yes, 2 = no, 0 = end of file) You should: Circle ONLY statements that contain LOCIC errors. Next to the circled statement, provide the correct LOCICExplanation / Answer
All Assignments should be comparisons like (== ) [double equal to and not single equal to]
1. gender =="2" //Should be two for female
2.collegeyears == "1"
3.collegeyears == "2"
4.certificate=="1" //It should be 1 for yes
WE need to remove
ELSE
Total certificate = totalcertificate -1 [why we need to decrese certificate , if they dont have it ]
Things TO ADD
IF certificate == "1" //Already there
total certificate = totalcertificate + 1 //Its there
if gender =="2"
sumfemaleswithcertificate = sumfemaleswithcertificate + 1
END IF
END IF
6. averageagefemales = totalage/ sumofallfemales
Thanks, let me know if there is any concern.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.