Question

5. Define a LISP function MONTH-INTEGER which takes as argument a symbol that should be the name of a month, and which returns the number of the month. For example, (MONTH-INTEGER MARCH) 3 and (MONTH-INTEGER JUNE) 6. If the argument is not a symbol that is the name of a month, the function should return the symbol ERROR. E.g., (MONTH-INTEGER C) ERROR, (MONTH-INTEGER 7) ERROR ( MONTH-INTEGER QUOTE)-> ERROR, and ( MONTH-INTEGER (MAY))-> ERROR. 6. Define a LISP function SCORE->GRADE which takes a single argument, s, and returns a symbol according to the following scheme: #290 87Ss<90 A 83Ss<87 B 80 s<83 B 77$s<80 B 3 Ss<77 C 705s<73 C 60S$<70 D s<60 If the argument s is not a number then the function should return NIL Examples: (SCORE->GRADE 86.3)B+ (SCORE->GRADE 106)A (SCORE->GRADE-10.1)F SCORE->GRADE 59.9)F (SCORE->GRADE 83) B+ (SCORE->GRADE 74) SCORE->GRADE 67)D SCORE->GRADE (86.3NIL (SCORE->GRADE DOG)NIL C+ SCORE->GRADE 87.0)A-
0 0
Add a comment Improve this question Transcribed image text
Answer #1

5)

(defun getmonth (monthname)

(case monthname

(JANUARY (print "1"))

(FEBRUARY (print "2"))

(MARCH (print "3"))

(APRIL (print "4"))

(MAY (print "5"))

(JUNE (print "6"))

(JULY (print "7"))

(AUGUST (print "8"))

(SEPTEMBER (print "9"))

(OCTOBER (print "10"))

(NOVEMBER (print "11"))

(DECEMBER (print "12"))

(otherwise '(ERROR))

))

6)

(defvar *marks*)
(defun fun(marks))
(setq marks(read))

if(>= marks 90)
(format t"A~%")

(if (and (>= *marks87* ) (<= *marks* 90) )
(format t "A-~%")

(if (and (>= *marks83* ) (<= *marks* 87) )
(format t "B+~%")

(if (and (>= *marks80* ) (<= *marks* 83) )
(format t "B~%")

(if (and (>= *marks77* ) (<= *marks* 80) )
(format t "B-~%")

(if (and (>= *marks73* ) (<= *marks* 77) )
(format t "C+~%")

(if (and (>= *marks70* ) (<= *marks* 73) )
(format t "C~%")

(if (and (>= *marks60* ) (<= *marks* 70) )
(format t "D~%")

(otherwise format t "NIL")

Add a comment
Know the answer?
Add Answer to:
5. Define a LISP function MONTH-INTEGER which takes as argument a symbol that should be the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Write a Lisp function called piece which takes a single argument x and implements the followin...

    1. Write a Lisp function called piece which takes a single argument x and implements the following piecewise linear function: piece(x) = x if 0 < x < 1 2. Write a Lisp function called intList which takes two integer arguments, a and b and returns the list of all integers from a to b (inclusive at both ends). For example, (intList 3 8) should return (345678) 1. Write a Lisp function called piece which takes a single argument x...

  • Lisp program count-of (symbol list): Write a function named count-of that takes two parameters, a symbol...

    Lisp program count-of (symbol list): Write a function named count-of that takes two parameters, a symbol and a list. Count the number of instances of x in the list. Do not count the number of x in any sub-lists within the list. Test: count-of 'a '(a 'a(a c) d c a). Result: 2 trim-to (symbol list): Write a function named trim-to that takes a symbol and list as parameters. Return a new list starting from the first occurrence of the...

  • Define a function called AddEvenPosDigs(string), which takes a string (with symbols and characters) as an argument,...

    Define a function called AddEvenPosDigs(string), which takes a string (with symbols and characters) as an argument, and returns an integer. This function should add the digits of a string that are in an even position. If there are no digits, the function should return -1. As an example, the following code fragment: string = "a12b056jk"; result=AddEvenPosDigs(string); print(result) should produce the output: 8

  • How to Define a function named calculatePI that takes a positive integer n as its argument...

    How to Define a function named calculatePI that takes a positive integer n as its argument and calculates π using the formula: (Assume n is odd, which is the precondition of the function. And, this function should return double type value.) π = 4*(1 – 1/3 + 1/5 – 1/7 + 1/9 – 1/11 + ... 1/n)

  • USE PYTHON PLEASE Write a function called is prime which takes a single integer argument and...

    USE PYTHON PLEASE Write a function called is prime which takes a single integer argument and returns a single Boolean value representing whether the given argument is prime (True) or not (False). After writing the function, test it by using a loop to print out all the prime numbers from 1-100. To check your results, the prime numbers from 1-100 are: 2, 3, 5, 7, 11. 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,...

  • Write a program in scheme using eopl language. Define a function "symbol-count" which takes a flat...

    Write a program in scheme using eopl language. Define a function "symbol-count" which takes a flat list of symbols and returns a list of lists in which each symbol is paired with the count of how many times it occurs in the original input. > (symbol-count '(b a)) '((b 1) (a 1))

  • Write a Python function binom_product that takes integer arguments a and b and positive integer argument...

    Write a Python function binom_product that takes integer arguments a and b and positive integer argument n and returns the product of the coefficients in the expansion of (ax + by)”. Example: Let a = 2, b = -1, and n = 3. Then (2x – y)3 = 8x3 – 12x²y + 6xy2 – 43 The product of the expansion coefficients is 8 x -12 x 6 x -1 = 576 Notes: There are two visible test cases and three...

  • Please help with all four questions regarding LISP Programming. Thank you. Please answer all questions with...

    Please help with all four questions regarding LISP Programming. Thank you. Please answer all questions with output plesase. LISP Programming Assignment It is a good idea to start this assignment early; Lisp programming, while not inherently difficult, often seem somewhat foreign at first, particularly when it comes to recursion and list manipulation. This assignment is loosely based on material by Dr. Henri Casanova.   Problem #1 Define a function that takes two arguments and returns the greater of the two. Problem...

  • Design a function named max that accepts two integer values as arguments and returns the value...

    Design a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two. Need Variable lists, Psuedocode, ipo chart, Flow Chart, and a python...

  • Python problem. 3. (6 pts) Define the following four sorting functions: each takes an argument that...

    Python problem. 3. (6 pts) Define the following four sorting functions: each takes an argument that is a list of int or str or both values (otherwise raise an AssertionError exception with an appropriate error message) that will be sorted in a different way. Your function bodies must contain exactly one assert statement followed by one return statement. In parts a-c, create no other extra/temporary lists other than the ones returned by calling sorted. a. (2 pts) Define the mixed...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT