lundi 30 septembre 2019

Is this pseudocode solution correct? (Update)

Can someone check my code? (pseudocode problem)?

Here's the problem I have to solve: The CIS Department is looking to get audit reports printed for its employees that detail enrollment in each of the programs monitored by the department. The reports (which will be run only once to produce all that is required) will detail on a single page the name of the program, number of students enrolled in the program, and the names of the students in the program. The CIS department monitors Cisco Networking, Computers and Information Systems, Data Assurance and IT Security and Web Design.

I'm still new to programming, hoping someone can confirm if I put all of the values in the right place. For instance, after ENDIF, should I put "produce" or something else? Feedback would be greatly appreciated!

Here's my defining diagram and solution...

DEFINING DIAGRAM:

input
Program name

output
program name
number of students
student  names

processing
Prompt for program name
Read program name
Print report

SOLUTION:

Produce audit_report

Print 'Program name'

    Read program name

   IF program name = 'Cisco Networking' 

  OR 'Data Assurance' 

  OR 'Web Design'

  OR 'CIS'

  THEN

    Print program_name, number_students, student_names

ELSE

    Print  'program not found'

ENDIF

END

Aucun commentaire:

Enregistrer un commentaire