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

Write a Lisp function that computes a batter’s slugging average given number of

ID: 3620016 • Letter: W

Question

Write a Lisp function that computes a batter’s slugging average given number of singles, doubles, triples, home runs and outs. Slugging average = # of bases / at-bats. Make sure the output is a floating point number. Example: (slugging 10 5 0 1 15) returns 0.7741935 2. Write a Lisp function to compute a student’s grade given the number of points he or she has accumulated and the total number of points available. Example: (grade 162 188) returns B 3. 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 What to turn in: Hints and Notes: • An out = 0 bases, single = 1 base, double = 2 bases, triples = 3 bases, home run = 4 bases. The sum of all of these values is the number of at-bats. • 90% or greater = A; 80% or greater = B; 70% or greater = C; 60% or greater = D; otherwise F. • 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 allowed.

please guys help me in writing these lisp functions!! I think it's an easy program if I would have written it in java or c++ but not Lisp!!! I don't have any idea about this language :S
this is the only thing that I could figure out:

( defun slugging (single double triple homerun out)
(setq (single 1 double 2 triple 3 homerun 4 out 0))
(/(+((* single 1)(* double 2)(* triple 3) (* homerun 4) (* out 0)(+ single double triple homerun out )))
)
)

(defun grade (x y)
(set 'n'(* 100 (/ x y )))
(if (>= n 90) ( message "A 1")) and so on


However, I'm not sure if my way in assigning the n value is correct or not

thanks a lot for your help

Explanation / Answer

Dear, Hi As the technology is upgrading None of us tend to learn Lisp but as per yu request high priority post I tried maximum to help you still any doubts come up we are here to assist you.. 2.     Function returns grade of given points    (defun grade (x y)
(set 'n'(* 100 (/ x y )))
(if (>= n 90) ( message "A 1")) (if (>= n 80) ( message "B 2")) (if (>= n 70) ( message "C 3")) (if (>= n 60) ( message "D 4")) (if (< n 60) ( message "F 5")) ) 3.         (defun gpa(list)            (set a 4.0)             (set a- 3.67)              (set b 3.0)             ( set b- 2.67)               (set b+ 3.33)                 (set c 2.0)                (set c- 1.67)                 (set c+ 2.33)                   (set d 1.0)                    (set d+ 1.33)                      (loop for i list in '(a a b- b+ a-)                               sum i)                     ) Hope this will help you...             
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote