use context essentials2021 # functions from last time: fun pen-cost( num-pens :: Number, message :: String) -> Number: num-pens * (0.25 + (0.02 * string-length(message))) end fun add-shipping-cost(order-cost :: Number) -> Number: if order-cost <= 0: 0 else if (order-cost <= 12) or (order-cost == 23): order-cost + 4 else: order-cost + 6 end end # Write an expression to compute the total order cost for 30 pens reading "CSCI0111" #----------------------------------------------------------# #| Professor Telson cares about two things: his students and the environment. Therefore, he has decided to offer students a makeup quiz to help boost their grades from a C to an B. He is giving this option to students in both sections of his course. To save paper, he realizes that he only needs to print the makeup quiz for students who are not taking the course S/NC. He also computed that only students who scored lower than 62 on quiz 1 or lower than 70 on quiz 2 should get the makeup quiz. Professor Telson has many emails to answer and wants to use programming to help him decide whether he should print a quiz for a given student. |# #----------------------------------------------------------# fun get-grade( student-name :: String, assignment :: String) -> Number: doc: "Produce the score that the given student got on the given assignment" if student-name == "Viktorija": if assignment == "Quiz 1": 87 else if assignment == "Quiz 2": 53 else: raise("Assignment not found!") end else if student-name == "Pranav": if assignment == "Quiz 1": 72 else if assignment == "Quiz 2": 99 else: raise("Assignment not found!") end else: raise("Student not found!") end end