Question: USE RACKET PROGRAMMING LANGUAGE AND VERIFY OUTPUTS OR I WILL DISLIKE Question 3: Transit Passes In Berlin, you can buy transit passes that are good

 USE RACKET PROGRAMMING LANGUAGE AND VERIFY OUTPUTS OR I WILL DISLIKE

USE RACKET PROGRAMMING LANGUAGE AND VERIFY OUTPUTS OR I WILL DISLIKE

Question 3: Transit Passes In Berlin, you can buy transit passes that are good for 1 day, 7 days, or 30 days. When you first use a pass, a machine stamps it in a way that can be decoded to give the day of the year: for example, on January 31 it would stamp"31", and on February 1 it would stamp "32". Write a function (check-ticket stamp-date today type). Each of stamp-date and today is an integer between 1 and 366 representing a day of the current year: the date on which the ticket was stamped, and today's date. type is a symbol: either 'day, 'week, or 'month, indicating if the pass is good for 1,7, or 30 days. The function produces 'expired if it was stamped too long in the past. In the unlikely event that it was stamped in the future, it produces 'future. Otherwise, it produces a string of the form "valid for xxx days" indicating how many days it is good for. Here are some examples: 1 > (check-ticket 15 16 'day) 2 "expired 3 > (check-ticket 100 140 'month) 4 "expired 5 > (check-ticket 15 14 'day) 6 'future 7 > (check-ticket 15 15 'day) 8 "valid for 1 days" 9 > (check-ticket 15 15 'week) 10 "valid for 7 days" 11 > (check-ticket 100 120 'month) 12 "valid for 10 days" You may assume that both stamp-date and today refer to dates in the same year

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!