Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.Using the polynomials code we have developed in class, write a Lisp function t

ID: 3679874 • Letter: 1

Question

1.Using the polynomials code we have developed in class, write a Lisp function that multiplies a

polynomial by a term.

Example: (multiply-poly-term ‘((1 1) (5 0)) ‘(5 1)) returns ((5 2) (25 1))

2.

Write a Lisp function to compute a student’s grade point average from a list of letter grades. You’ll

want to write a separate function to compute grade points from letter grades.

Example: (gpa '(a a b- b+ a-)) returns 3.534 Use the following scale for this assignment:

A = 4.0; B = 3.0; C = 2.0; D = 1.0; + increases grade by 0.33; - decreases grade by 0.33; D- and A+ not

Explanation / Answer

1)

2)

(setf gpa 0
tot-credit-hrs 0)

(format t "GPA calculator.~%Input 0 for credit hours to stop entering~%")

(loop while t do
(format t "~%New Course~%Credit hrs: ")
(setf credit-hrs (read))
(if (zerop credit-hrs)
(progn
(format t "~%Completed entering courses~%")
(return))   
(progn
(format t "The Grade points are: ")
(setf grade-points(read))))
(setf gpa(+ gpa (* credit-hrs grade-points)))
(setf tot-credit-hrs (+ tot-credit-hrs credit-hrs))
)

(setf gpa (/ gpa tot-credit-hrs))

(format t "~%The GPA is : ~$~%" gpa)

(setf gpa 0
tot-credit-hrs 0)

(format t "GPA calculator.~%Input 0 for credit hours to stop entering~%")

(loop while t do
(format t "~%New Course~%Credit hrs: ")
(setf credit-hrs (read))
(if (zerop credit-hrs)
(progn
(format t "~%Completed entering courses~%")
(return))   
(progn
(format t "The Grade points are: ")
(setf grade-points(read))))
(setf gpa(+ gpa (* credit-hrs grade-points)))
(setf tot-credit-hrs (+ tot-credit-hrs credit-hrs))
)

(setf gpa (/ gpa tot-credit-hrs))

(format t "~%The GPA is : ~$~%" gpa)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote