Due Date Thursday 01/27 at 9pm
Purpose Logistics; To write simple functions & tests relating to numbers, images, and strings
You should submit a single .rkt file containing your responses to all exercises via the Handin Server. We accept NO email submissions. Failure to submit a .rkt file will result in a 0. Please note that a .rkt~ file or .bak file will NOT be acceptable and will result in a 0.
You are only allowed to use the language specified at the top of this page: failure to do so will result in a 0.
Your code MUST conform to the guidelines outlined in the style guide on the course website. The style guide may be updated as the semester progresses so please remember to read it before submitting each assignment.
This will be an individual assignment.
The first exercise should be completed in the handin server. You do not need to write anything for this exercise in your submitted file.
The remaining exercises should all be completed in a single .rkt file which you should submit via the Handin Server. Please note that you can submit as many times as you like but only your most recent submission will be graded. This means that if you submit twice, once before the deadline and once after the deadline, the submission made after the deadline will be graded, and penalized accordingly.
Exercise 2 Read the Syllabus. Now, you know how many lectures there are this semester! You can also find the cost of tuition here. Using these numbers, and the theory that a full time student is taking 4 courses, calculate the cost of one lecture for CS2500. Define a constant for this calculation. Remember this calculation the next time you want to skip lecture. Remember that you are paying this cost whether or not you attend the lecture.
Exercise 3 Search the course website to find the names and email addresses of the tutors and TAs. In a comment, write the names of the TAs who have office hours on Saturday.
Exercise 4 Search the course website to find the style guide. In a comment, write the course policy on hanging parentheses. We expect you to follow this policy and will grade your assignments accordingly.
Exercise 5 In a comment, write the four forms of atomic data introduced in Chapter 1 of the textbook.
Exercise 6 In Pig Latin words that begin with a consonant are shifted so that the first letter goes to the end of the word and is then followed by the suffix "ay". Write a function, pig-latinize that, given a word, follows this pattern. You may assume that the word begins with a consonant and that moving the first letter is enough (that is, given the word "crater" we expect the function to produce "ratercay" even though this is not quite how Pig Latin works). Write at least 2 tests for this function.
Hint: The String function documentation is a useful place to look for functions that operate on Strings.
Exercise 7 Write a function, middle, which, given three arguments, produces the second one. Provide at least two tests for this function. In a comment, explain what types of values this function can take as inputs and what types of values it can produce.
Exercise 8 Yak Travel Agency arranges trips for climbing Mount Everest. For each trip, they charge an initial fee in addition to $0.15 for each vertical meter climbed. For instance, the price for climbing all the way to the summit, which is 3500 meters above the base of the mountain, is $645. Define a BSL function which, given the number of vertical meters climbed, produces the cost of a trip led by the Yak Travel Agency. Write at least two tests for this function.
Hint: it can be useful to write out a table of input/output pairs to help understand these types of mathematical relationships (and these can then provide great tests!)
Exercises 9 and 10 will ask you to provide "sufficient" tests. We are looking for you to test all the interesting cases of the function. This includes each case of any conditionals you write, as well as edge cases (when the inputs are on the edge of a condition).
Exercise 9 Write a function, valid-date? which, given a String representing the month of the year (e.g. "January") and a Number representing the day of the month, returns a Boolean if this is a valid date. Your function should return true if the date is sometimes valid (e.g. February 29th). You should also provide sufficient tests for this function.
Exercise 10 Complete exercise 17 in section 2.1 of the textbook. You should also provide sufficient tests for this function.
Hint: The Image function documentation is a useful place to look for functions that operate on Images.
Exercise 11 In this exercise you will build a scene by defining a constant with a sensible name for each of the parts. The final scene should look similar to this:
You aren’t required to reproduce this exactly, but it should be close and adhere to the descriptions below. You may use the DrRacket documentation to find helpful functions. Note: extra credit will be given if the constants build on each other well and if the final scene resizes based on the side length of the square background.
A small, yellow circle in the upper-left corner region of a rectangle whose top 80% is light-blue and bottom 20% is dark brown
A forestgreen, thin oval overlapping the top of a tall light brown rectangle
A gold square with a red triangle on top, a tall purple rectangle in its bottom middle, and two orange-outlined squares equally spaced from the center and above the purple rectangle
On top of part (a), place part (b) on the left (level with the dark-brown portion of the image), and part (c) on the right (also level with the dark-brown portion of the image).