Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Pupils in school are allocated a pupil code identifying them as follows last two digits of the year started then First 5 Digits of surname and First initial. We are assuming all pupils have a surname of at least 5 characters
- For example, Freda Bloggs who joined in 2021 would have the code 21bloggf
- (a) Complete the following pseudocode for a function definition that would take year, surname and first name as parameters and return the pupil code
- 01 function pupilcode(year,…………………… ,……………………)
- 02 yrpart = year.subString(2,2)
- 03 snpart = surname.subString(0,……………………)
- 04 fnpart = firstname.subString(0,1)
- 05 ………………… yrpart + snpart.lower + fnpart.lower
- (b) Use pseudocode to write the algorithm that does the following
- • Inputs the year, surname and first name of the pupil
- • Uses the pupilcode function to work out the pupilcode
- • Adds the pupil code to a text file as a permanent record called pupilcodes.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement