Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help with pseudocode assignment! about reading record and add them and print them
    primarykey
    data
    text
    <p>A file of student records contains name, gender (M or F), age (in year) and marital status (single or married) for each student. Design an algorithm that will read through the file and calculate the number of married men, single men, and married women. Print these numbers on a student summary report. If any single men are over 30 year of age. Print their names and ages on a separate eligible bachelors report.</p> <p>Can anyone tell me if I am wrong in any line? thanks! hope you can help me!</p> <pre><code>Set marriedMen to 0 Set singleMen to 0 Set marriedWomen to 0 Set singleWomen to 0 READ name, sex, age, status DOWHILE(NOT EOF) IF (status = married) THEN //check if status is married, if yes then check next IF (sex = ‘F’) THEN //check if sex is F, if yes then +1 marriedWomen = marriedWomen + 1 ELSE IF (sex = ‘M’) THEN //under married, and sex is M then +1 marriedMen = marriedMen + 1 ENDIF ENDIF ENDIF IF (status = single) THEN //check if status is single, if yes then check next IF (sex = ‘F’) THEN //check if sex is F, if yes then +1 to singleWomen singleWomen = singleWomen + 1 ELSE IF (sex = ‘M’) THEN //under single, and sex is M then +1 singleMen = singleMen + 1 IF (age &gt; 30) THEN //under single, sex = M and age is over 30 then print the name, age Print ‘Eligible bachelors Report’ Print ‘Name: ‘, name Print ‘Age: ‘, age ENDIF ENDIF ENDIF ENDIF READ next record ENDDO Print ‘Student Summary Report’ Print ‘Married Men: ‘, marriedMen Print ‘Single Men: ‘, singleMen Print ‘Married Women: ‘, marriedWomen Print ‘Single Women: ‘, singleWomen </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload