1. For the following please show a screenshot of your function being called and
ID: 3537245 • Letter: 1
Question
1. For the following please show a screenshot of your function being called and its result
(5pts) #1 Rewrite the following code in Haskell
if ( books < 1)
numCoupons = 0;
else if (books < 3)
numCoupons = 1
else if (books < 5)
numCoupons = 2
else
numcoupons = 3;
(5pts) Write a Haskell function that converts Fahrenheit to Celsius (formula is F=9/5C+32)
(5pts) Write a function that takes the string and removes the punctuation marks and spaces from it. Use the string: %u201CI am the Lorax, I speak for the trees%u2026 Now, thanks to your hacking my trees to the ground, there's not enough truffula fruit to go round!!!!%u201D
Explanation / Answer
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: import System.Environment num_coupons books | books < 1 = 0 | books < 3 = 1 | books < 5 = 2 | otherwise = 3 main = print (num_coupons 3) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: import System.Environment f_to_c f = (f-32)*5/9 main = print (f_to_c 108) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: import System.Environment f [] = [] f (' ':a) = f a f (',':a) = f a f ('.':a) = f a f ('!':a) = f a f ('?':a) = f a f (a:b) = a : f b main = print (f "I am the Lorax, I speak for the trees. Now, thanks to your hacking my trees to the ground, there's not enough truffula fruit to go round!!!!") :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: (add any other punctuation marks you wish)Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.