Homework 4 – UMBC – CMSC331 – Summer 2021 Due on July 2, 2021 11:59 PM
We need to write a program in Racket to print the student letter grades to the standard output. You start with the file hw4.rkt. The file includes data definition and the prototypes of the functions required to be implemented. You implement the functions in the same file and submit it to two places:
1 – Submit the file as “hw4.rkt” through the SUBMIT utility in your GL account. 2 – Submit the file as “hw4.rkt” to Blackboard.
The data in the file is as follows, it is a list of lists, therefore, it is a 2D list:
(define student-records (cons ‘(“Name” “CMSC 341 Grade”)
‘((“John” 81) (“Liz” 90) (“Dr Who” 43) (“Rob” 76) (“Bond” 110)
) )
)
The output of the program should be formatted as it follows, the grades are aligned in a column:
John Liz
Dr Who Rob Bond
=> B
=> A
=> F
=> C
=> ERROR
You need to implement two functions as it follows. For the detail implementation of every function, please refer to the description in hw4.rkt file.
• (print-grades records)
• (find-letter-grade student)
The following list of Racket functions is provided to help you start. You can refer to Racket documentation online at (https://docs.racket-lang.org/):
• The function (number? …) can be used to test whether a symbol is a number or not.
• The function (list-ref …) can be used to access a specific member of a list by using an
index.
• The function (string-append …) can be used to build strings.
• The function (number->string …) can be used to convert a number to a character string.
• The function (newline) can be used to print a new line character.
• The function (for-each func lst) can be used for iterating through a list.
You can learn more on differences between “for-each” and “map” for iterating through lists at the following link: https://stackoverflow.com/questions/27475738/for-each-and-map-in-scheme Comparing “map” and “for-each” – “map” returns a return value, but “for-each” does not.
The following is the link to for-each description in Racket documentation:
https://docs.racket-lang.org/reference/pairs.html?q=for- each#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._for-each%29%29 The following is the link to map description in Racket documentation: https://docs.racket- lang.org/reference/pairs.html?q=map#%28def._%28%28lib._racket%2Fprivate%2F map..rkt%29._map%29%29
There also are other loop statements that can be used for iterating through a list.
• The function (cond …) can be used for conditionals.
• The function (and …) can be used for logic testing.
• The function (or …) can be used for logic testing.
• You can also use other functions as you wish.
• The program is using racket language “#lang racket” as it is indicated at the beginning of the file hw4.rkt. You are not allowed to modify this. You are not allowed to use other languages in Racket package.
• You are not allowed to modify the data definition, i.e. “student-records”.
• You are not allowed to modify the signature of the functions you are implementing.
• You are not allowed to modify the function call at the end of the file. That is the main
function that executes the program.
Your program will be evaluated based on the following criteria:
• It should run without error
• It should give the correct output
• It should implement the functions required
• Every function implementation should satisfy the described requirements in the file hw4.rkt. The requirements for every function are described before the function prototype in the file.
Submission
Please note, you submit the file hw4.rkt on Blackboard and also to your gl account using the following commands. We will run your code on the gl machine. If you forget to submit to gl server, you’ll lose the points for that part.
Submission mechanism: Submission to gl server for this assignment happens through submit utility in gl servers of UMBC. You need to be in the directory that contains your files.
To submit your modified hw4.rkt file use this command: submit cmsc331_donyaee proj4 hw4.rkt
To resubmit (overwrite) a file:
submit cmsc331_donyaee proj4 hw4.rkt
To list files that you have submitted:
submitls cmsc331_donyaee proj4
To delete the files you have submitted:
submitrm cmsc331_donyaee proj4 hw4.rkt
There is a help file on using the submit utility at the following URL: https://wiki.umbc.edu/pages/viewpage.action?pageId=105284083