Courses‎ > ‎Intro to CS - Half Year‎ > ‎Dyrland-Weaver‎ > ‎Work‎ > ‎

### Work 10: 9/28

posted Sep 28, 2018, 11:08 AM by JonAlf Dyrland-Weaver
 Write the following racket functions:salePriceTakes 2 arguments, the first represents the original price of an item, the second represents the number of weeks it has been on sale.Returns the current price of the item based on how many weeks it has been on sale.Items on sale for 0 weeks will cost the full amountItems on sale for 1 week will cost 75% of the full amountItems on sale for 2 weeks will cost 50% of the full amountItems on sale for 3 or more weeks will cost 25% of the full amount.Examples(salePrice 200 0) ==> 200(salePrice 200 1) ==> 150(salePrice 200 2) ==> 100(salePrice 200 3) ==> 50productionTakes 2 arguments, the first represents an hour of the day between 6 and 20 (8pm in 24 hour time format), the second represents the number of workers at a factory.Returns the number of widgets produced by the factory in the given hour by the given number of employees.The amount of widgets a worker makes is based on the time of dayBetween 6 and 10 (including 6 but excluding 10) each worker can make 30 widgets in an hour.Between 10 and 14 (including 10 but excluding 14) each worker can make 40 widgets in an hour.Between 14 and 20 (including 14 but excluding 20) each worker can make 35 widgets in an hour.You can assume that only valid times are provided for the hour parameter.Examples(production 8 2) ==> 60(production 13 4) ==> 160(production 17 1) ==> 35isLeapYearTakes a single parameter representing a year.Returns #t if the year is a leap year, and #f if it is notThe rules for leap year-ness are as followsYears that are divisible by 4 are leap years, except:Years that are divisible by 100 are not leap years except:Years that are divisible by 400 are leap years.Examples(isLeapYear 2012) ==> #t(isLeapYear 1900) ==> #f(isLeapYear 2000) ==> #t(isLeapYear 1983) ==> #fIn case you don't believe me about the leap year rules: http://en.wikipedia.org/wiki/Leap_yearSubmit this as: conds