CS 5010: Problem Set 01
Out: Monday, 11 September 2017
Due: Monday, 18 September 2017 at 6pm local time
This is an individual assignment. You are not allowed to discuss this problem set with any other person. You are also not allowed to search for or to view any solutions to similar problems that may be available on the World-Wide Web or in other resources that might otherwise have been available to you.
The main purpose of this problem set is to give you some practice with the systems we will use in CS 5010.
In particular, you need to know how to commit your solution and how to push your commits to the course's GitHub site. To submit your solution, follow our instructions on how to submit your homework, and be sure to include the required deliverables.
We will check to see whether your have submitted a solution for this problem set and whether it contains the required deliverables, but this problem set will not otherwise be graded.
You must use Racket's HtDP Intermediate Student Language (ISL) for this problem set.
You should begin your work on this problem set by using
git
to clone your GitHub repository from the
CS 5010 GitHub site.
The name of your GitHub repository is
pdp-
YOURNAME, where YOURNAME
is your CCIS ID.
Your repository will probably be empty when you clone it.
Within your cloned repository, you should create a new
directory named set01
.
All of the code you write for this problem set will go into
that directory.
You will also need to download a copy of
extras.rkt
and put it in your set01
directory along with
the q1.rkt
through q5.rkt
files
you will write for this problem set.
Each of those files must import that library by including
the lines
(require rackunit) (require "extras.rkt")
near the top of the file, preceded only by your comments describing the file.
Immediately following those require
declarations,
your file should state a provide
declaration for
each deliverable function.
Those provide
declarations allow our testing
infrastructure to require
your file and check
to see whether you've provided all of the deliverable functions.
Also, include a line calling check-location
to check whether your file is correctly named and in the
right place in your repository.
That call to check-location
must be
placed after the require
declarations,
but can go before the provide
declarations.
Thus, for problem 1, the top of your file should say
(require rackunit) (require "extras.rkt") (check-location "01" "q1.rkt") (provide pyramid-volume)
Remember to follow the design recipe. Your deliverables include the data definitions you need (including interpretations and templates), contracts, purpose statements, examples and tests, and design strategies in addition to your function definitions.
Remember to fill out a
work session report
at the end of each
work session. Tell git
to add
it to
the files you will commit, and then commit and push that report
in addition to committing and pushing your entire
set01
directory. Do this at the end of every work
session.
-
Write a function named
pyramid-volume
that, given values x and h in units of meters, returns the volume in cubic meters of a pyramid of height h whose square bottom has sides of length x. (Hint: the volume of any pyramid is one third the area of its base times its height.) Put your solution in a file namedq1.rkt
. -
A few countries have not yet converted to the metric system.
Write a function named
furlongs-to-barleycorns
that, given a length in furlongs, returns the number of barleycorns in that length. (Hint: one furlong is ten chains; one chain is four rods; one rod is sixteen and a half feet; one foot is twelve inches; one inch is three barleycorns. Put your solution in a file namedq2.rkt
. -
Write a function named
kelvin-to-fahrenheit
that, given a temperature in Kelvin, returns the number of Fahrenheit degrees. (Hint: 0 K is -273.15 degrees Celsius, and 273.15 K is 0 degrees Celsius.) Put your solution in a file namedq3.rkt
. -
For scientific applications, the speed of a microprocessor
is often expressed as the number of floating point operations
it can perform per second; one floating point operation per
second equals 1 FLOPS.
Write a function named
flopy
that, given the speed of a microprocessor in FLOPS, returns the number of floating point operations it can perform in one 365-day year, with each day consisting of exactly 24 hours. Put your solution in a file namedq4.rkt
. -
The Java type
double
consists of 264 distinct values, and double precision addition takes two of those values as inputs, so exhaustive testing of double precision addition involves 2128 additions. Write a function namedyears-to-test
that, given the speed of a microprocessor in FLOPS, returns the number of 365-day years it would take to test the double precision addition operation on all legal inputs. Put your solution in a file namedq5.rkt
.