Answer to Question #278741 in Algorithms for Moon

Question #278741

A school has 1800 students. The start date and leaving date for each student is stored on file. Dates are in the format YYMMDD (e.g. a student starting on 10th September 2007 and leaving on 4th August 2012 has the data 070910 and 120804 on file).

(a) Write an algorithm, using pseudocode or otherwise, which

• inputs Student ID for all 1800 students

• inputs the start date and leaving date for each student

• carries out a check to ensure the second date is later

• if error, increments error counter

• outputs the number of errors 


1
Expert's answer
2021-12-12T01:17:54-0500
Start
   Declare variable startDate    
   Declare variable leavingDate
   Declare variable errorCounter
   Set errorCounter=0 
   for i =0 to 1800
        Read ID from the file
        Read startDate from the file
        Read leavingDate from the file
        if startDate> leavingDate then
             errorCounter=errorCounter+1
        end if
   end for
   Display errorCounter
Stop

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS