SlideShare a Scribd company logo
1 of 18
CS 111 - Homework 2 p. 1
CS 111 - Homework 2
Deadline
11:59 pm on Friday, February 3, 2017
Purpose
To practice defining and using named constants, and to practice
using the design recipe to write and test
functions.
How to submit
Each time you would like to submit your work:
• save your current Definitions window contents in a file with
the name 111hw2.rkt
– Note: please use that *exact* name -- do not change the case,
add blanks, etc. If I search for a file with
that name in your submission, I want it to show up! 8-)
• transfer/copy that file to a directory on nrs-labs.humboldt.edu
(preferably in a folder/directory
named 111hw2)
– If you are in a campus lab, you can do so by copying them to
a folder on the U: drive
– If you are not in a campus lab, you can do so by using sftp
(secure file transfer) and connecting to
nrs-labs.humboldt.edu, and then transferring them.
Graphical versions of sftp include WinSCP and Secure Shell
Transfer Client for Windows,
Cyberduck and Fugu for Mac OS X, and FileZilla that has
versions for both Windows and Mac OS X.
(Mac OS X and Linux also come with a command-line sftp -- an
intro to this is included in the
posted handout, "useful details - sftp, ssh, and
~st10/111submit", available on the public
course web site in the References section and in the Homework
1 section.)
– Whichever version of sftp you are using, use a host name of
nrs-labs.humboldt.edu if you
are not in a campus lab (you can get away with just nrs-labs for
the host name in a campus lab),
your campus username, and when you are prompted for it, your
campus password. IF you need to give
a port number, give a port number of 22.
• Now that your file is on nrs-labs.humboldt.edu, you need to
log onto nrs-labs.humboldt.edu using ssh, so
you can submit your file to me.
– In BSS 313, the Windows computers have a graphical version
of ssh called PuTTY. There is a
graphical version of ssh for Mac OS X named Jelly FiSSH,
(although Mac OS X and Linux also come
with command-line ssh, and an intro to this is also included in
the "useful details - sftp, ssh, and
~st10/111submit" handout.)
– Again, whichever version of ssh you are using, use a host
name of nrs-labs.humboldt.edu if
you are not in a campus lab (you can get away with just nrs-labs
for the host name in a campus
lab), your campus username, and when you are prompted for it,
your campus password. IF you need to
give a port number, give a port number of 22.
• WHILE you are logged onto nrs-labs:
– IF you saved your file in a folder, use cd to change to the
folder/directory where you saved it -- for
example, if you saved it in the folder 111hw2, then you would
go to that directory by saying:
CS 111 - Homework 2 p. 2
cd 111hw2
– use the ls command to make sure your 111hw2.rkt file is
really there:
ls
– type the command:
~st10/111submit
...and when asked, enter a homework number of 2
...and when asked, enter y, you do want to submit all files with
an appropriate suffix (I don't mind
getting some extra files, as long as I also get 111hw2.rkt; I'd
rather receive too many files than too
few due to typos.)
...make sure to carefully check the list of files submitted, and
make SURE it lists 111hw2.rkt as
having been submitted! (The most common error is to try to run
~st10/111submit while in a
different directory than where your files are...)
• (we practiced the above during the Week 1 Lab, on Friday,
January 20 -- ASK ME if this is still not clear,
or if you have any problems with submission! If you get stuck,
E-MAIL me your 111hw2.rkt file as an
e-mail attachment before the deadline, AND then ALSO submit
it as soon after that as you are able.)
– I am happy to walk through submitting files with you -- just
come by my office during office hours, or
e-mail me to set up an appointment.
Important notes
• Signature and purpose statement comments are ONLY required
for function definitions -- you do NOT
write them for named constants or for non-function-definition
compound expressions.
• Remember: A signature in Racket is written in a comment, and
it includes the name of the function, the
types of expressions it expects, and the type of expression it
returns. This should be written as discussed in
class (and you can find examples in the posted in-class
examples). For example,
; signature: purple-star: number -> image
• Remember: a purpose statement in Racket is written in a
comment, and it describes what the function
expects and describes what the function returns (and if the
function has side-effects, it also describes
those side-effects). For example,
; purpose: expects a size in pixels, the distance between
; points of a 5-pointed-star, and returns an image
; of a solid purple star of that size
• Remember: it is a COURSE STYLE STANDARD that named
constants are to be descriptive and written
in all-uppercase -- for example,
(define WIDTH 300)
• You should use blank lines to separate your answers for the
different parts of the homework problems. If
you would like to add comments noting which part each answer
is for, that is fine, too!
• Because the design recipe is so important, you will receive
significant credit for the signature, purpose,
header, and examples/check-expects portions of your functions.
Typically you'll get at least half-credit for
a correct signature, purpose, header, and examples/check-
expects, even if your function body is not correct
(and, you'll typically lose at least half-credit if you omit these
or do them poorly, even if your function
body is correct).
CS 111 - Homework 2 p. 3
Problem 1
Start up DrRacket, (if necessary) setting the language to How
To Design Programs - Beginning Student
level, and adding the HTDP/2e versions of the image and
universe teachpacks by putting these lines at the
beginning of your Definitions window:
(require 2htdp/image)
(require 2htdp/universe)
Put a blank line, and then type in:
• a comment-line containing your name,
• followed by a comment-line containing CS 111 - HW 2,
• followed by a comment-line giving the date you last modified
this homework,
• followed by a comment-line with no other text in it --- for
example:
; type in YOUR name
; CS 111 - HW 2
; last modified: 2017-01-30
;
Below this, after a blank line, now type the comment lines:
;
; Problem 1
;
And PLEASE NOTE -- you are not defining ANY new functions
in this problem, you are practicing writing
and using a named constant, and practicing writing some check-
expect compound expressions.
1 part a
Remember the image you created for Homework 1, Problem 7?
Write a Racket define expression to
define a named constant whose value is that image.
NOTE: You are probably more familiar with more image
operations now than you were when completing
Homework 1 -- as long as you still meet the requirements from
Homework 1, Problem 7, you can change
your image IF you would like. If you do create a different
image, I will use Homework 2's version in the
"class quilt" unless I hear from you otherwise.
As a reminder, here are those requirements:
• the final resulting image somehow should be the result of at
least THREE different image or image-
related operations from the 2htdp/image teachpack. (More is
fine!)
– They can be image operations from the "Some DrRacket
Tidbits" handout, OR they can be image
operations (from the 2htdp/image teachpack) that you find by
exploring DrRacket's Help feature,
described a bit at the end of the "Some DrRacket Tidbits"
handout.
• the final resulting image should be an expression of type
image that is precisely 200 pixels wide and 200
pixels high
– You might ask -- how can I be SURE my final image is the
right size? The function image-width
expects an image arguments, and returns its width in pixels --
and the function image-height
expects an image argument, and returns its height in pixels. So,
you can use these functions to check
the width and height of your final image, IF you would like.
CS 111 - Homework 2 p. 4
• ACCEPTABLE "extended" version of this problem: IF you
would like to use define to also give names
to some ADDITIONAL expressions to make your task easier,
that is allowed and encouraged (but not
required) for this problem.
• As long as you meet the above requirements, your image may
be as simple or as complex as you would
like.
1 part b
Recall that Homework 1, Problem 7 specified that this image
needed to be "precisely 200 pixels wide and
200 pixels high". You're now going to test that this is the case.
Recall that operation image-width expects an image and returns
its width in pixels, and that operation
image-height expects an image and returns its height in pixels.
Write TWO check-expect expressions:
• Write a check-expect expression, using image-width and your
named constant from Problem 1
part a, that will pass if your named constant image is indeed 200
pixels wide.
• Then, write a second check-expect expression, using image-
height and your named constant from
Problem 1 part a, that will pass if you named constant image is
indeed 200 pixels high.
(What if you find out your image isn't 200 x 200 pixels? Then
you should modify your named constant
definition in Problem 1 part a so that it is.)
Problem 2
Next, in your definitions window, after a blank line, type the
comment lines:
;
; Problem 2
;
Now, you are defining a new function! Consider a function that
is to return the perimeter of a square.
2 part a
How many and what type of expressions should such a function
expect, to be able to return such a perimeter?
Decide on a good, descriptive name for this function, and write
an appropriate signature comment for this
function.
2 part b
Write an appropriate purpose statement comment for this
function.
2 part c
Write an appropriate function header for this function (putting
... ) for its body for now).
2 part d
Write at least 2 specific tests/check-expect expressions for this
function. Interestingly, you may actually
place these either before or after your not-yet-completed
function definition, whichever you prefer.
CS 111 - Homework 2 p. 5
2 part e
Only NOW should you replace the ... in the function's body with
an appropriate expression to complete
this function.
Run and test your function until you are satisfied that it passes
its tests and works correctly.
Finally, include at least 2 example calls of your function (such
that you will see their results) after your
function definition.
Problem 3
Next, in your definitions window, after a blank line, type the
comment lines:
;
; Problem 3
;
Consider a function that asks a given person how their day is
going. Given a person's name, it returns How's
it going, ...that person's name... ? (Optionally, you may change
the exact wording of the question, as
long as it includes the person's name and ends with at least one
question mark.)
3 part a
How many and what type of expressions should such a function
expect, to be able to return this question?
Decide on a good, descriptive name for this function, and write
an appropriate signature comment for this
function.
3 part b
Write an appropriate purpose statement comment for this
function.
3 part c
Write an appropriate function header for this function (putting
... ) for its body for now).
3 part d
Write at least two specific tests/check-expect expressions for
this function, placed either before or after
your not-yet-completed function definition, whichever you
prefer.
3 part e
Only NOW should you replace the ... in the function's body with
an appropriate expression to complete
this function.
Run and test your function until you are satisfied that it passes
its tests and works correctly.
Finally, include at least 2 example calls of your function (such
that you will see their results) after your
function definition.
Problem 4
Next, in your definitions window, after a blank line, type the
comment lines:
;
CS 111 - Homework 2 p. 6
; Problem 4
;
You decide it would be useful to be able to take some title text
and an image, and create a new image that
includes the given title above that image, such that the title text
is depicted in 25-pixel-high black letters that
are actually part of the image.
4 part a
Decide on a good, descriptive name for this function, and write
an appropriate signature comment for this
function.
4 part b
Write an appropriate purpose statement comment for this
function.
4 part c
Write an appropriate function header for this function (putting
... ) for its body for now).
4 part d
Write at least two specific tests/check-expect expressions for
this function, placed either before or after
your not-yet-completed function definition, whichever you
prefer.
4 part e
Only NOW should you replace the ... in the function's body with
an appropriate expression to complete
this function.
Run and test your function until you are satisfied that it passes
its tests and works correctly.
Finally, include at least 2 example calls of your function (such
that you will see their results) after your
function definition.
Problem 5
Next, in your definitions window, after a blank line, type the
comment lines:
;
; Problem 5
;
Consider a function total-inches that expects a number of feet
and a number of inches, and returns the
total number of inches. (For example, the value of the
expression (total-inches 4 5) should be 53,
because 4 feet and 5 inches is 53 inches overall.)
5 part a
This part comes BEFORE starting function total-inches!
FIRST: write a Racket definition for a named constant that will
define the name IN-PER-FT to be the
number of inches in a foot. (IN-PER-FT is NOT a function! It is
just a number, the number of inches in a
single foot.)
CS 111 - Homework 2 p. 7
5 part b
NOW you are starting the design recipe for function total-
inches.
NOW, write an appropriate signature comment for the function
total-inches.
5 part c
Write an appropriate purpose statement comment for total-
inches.
5 part d
Write an appropriate function header for total-inches (putting ...
) for its body for now).
5 part e
Write at least two specific tests/check-expect expressions for
total-inches,
• at least one for a number of feet of 0, and
• at least one for a number of feet greater than 1,
• (each with a DIFFERENT number of inches),
...placed either before or after your not-yet-completed function
definition, whichever you prefer.
5 part f
Only NOW should you replace the ... in total-inches's body with
an appropriate expression to
complete it. For full credit, make sure that you use the named
constant IN-PER-FT appropriately within
this expression.
Run and test your function until you are satisfied that it passes
its tests and works correctly.
Finally, include at least 2 example calls of your function (such
that you will see their results) after your
function definition.
Problem 6
Next, in your definitions window, after a blank line, type the
comment lines:
;
; Problem 6
;
(This is adapted from Homework 1 of J. Marshall's "The Way of
the Program" course at Sarah Lawrence
College.)
The Tasty-Waking coffee roasters sells whole-bean coffee at
$8.95 per pound plus the cost of shipping. Each
order ships for $0.85 per pound plus $2.25 fixed cost for
overhead.
(So, if someone buys 1 pound of their whole-bean coffee, the
total price is $12.05; if someone buys 2 pounds
of their whole-bean coffee, the total price is $21.85; if someone
buys 5 pounds, the total is $51.25.)
6 part a
The description above includes three constant, unchanging
values. Define an appropriate, descriptive named
constant for each of these values.
CS 111 - Homework 2 p. 8
6 part b
Now consider a function order-price whose purpose is to
calculate the total price for an order. Given
that you already know the values for the named constants given
in Problem 5 part a, how many and what type
of additional expressions should such a function expect, to be
able to calculate the price of a coffee order?
Write an appropriate signature comment for order-price.
(Hint: don't include named constants in the signature! Only
consider what the function needs BESIDES the
named constants to complete the task.)
6 part c
Write an appropriate purpose statement comment for this
function.
6 part d
Write an appropriate function header for this function (putting
... ) for its body for now).
(Hint: remember that named constants do not belong in a
function header, either.)
6 part e
Write at least two specific examples/tests/check-expect
expressions for this function, placed either
before or after your not-yet-completed function definition,
whichever you prefer.
6 part f
Finally, replace the ... in this function's body with an
appropriate expression to complete it. For full credit,
make sure that NOW you use the named constants from 5 part a
appropriately within this expression.
Run and test your function until you are satisfied that it passes
its tests and works correctly.
Finally, include at least 2 example calls of your function (such
that you will see their results) after your
function definition.
Problem 7
Next, in your definitions window, after a blank line, type the
comment lines:
;
; Problem 7
;
Decide on a function that will take one or more parameters and
return an image as a result. It can be anything
not yet written in class or on a previous homework problem
(variations on functions done in class or a
homework problem are fine).
7 part a
Decide on a good, descriptive name for your function, and write
an appropriate signature comment for this
function.
7 part b
Write an appropriate purpose statement comment for this
function.
CS 111 - Homework 2 p. 9
7 part c
Write an appropriate function header for this function (putting
... ) for its body for now).
7 part d
Write at least two specific tests/check-expect expressions for
this function, placed either before or after
your not-yet-completed function definition, whichever you
prefer.
7 part e
Only NOW should you replace the ... in the function's body with
an appropriate expression to complete
this function.
Run and test your function until you are satisfied that it passes
its tests and works correctly.
Finally, include at least 2 example calls of your function (such
that you will see their results) after your
function definition.
DeadlinePurposeHow to submitImportant notesProblem 11 part
a1 part bProblem 22 part a2 part b2 part c2 part d2 part e
Problem 33 part a3 part b3 part c3 part d3 part eProblem 44 part
a4 part b4 part c4 part d4 part eProblem 55 part a5 part b5 part
c5 part d5 part e5 part fProblem 66 part a6 part b6 part c6 part
d6 part e6 part fProblem 7 7 part a7 part b7 part c7 part d7 part
e

More Related Content

Similar to CS 111 - Homework 2 p. 1CS 111 - Homework 2Deadline1.docx

Bca1020 programming in c
Bca1020  programming in cBca1020  programming in c
Bca1020 programming in csmumbahelp
 
hw1.docxCS 211 Homework #1Please complete the homework problem.docx
hw1.docxCS 211 Homework #1Please complete the homework problem.docxhw1.docxCS 211 Homework #1Please complete the homework problem.docx
hw1.docxCS 211 Homework #1Please complete the homework problem.docxwellesleyterresa
 
Gráficas en python
Gráficas en python Gráficas en python
Gráficas en python Jhon Valle
 
body { text-align center; font-family sans-serif;}.docx
body {  text-align center;  font-family sans-serif;}.docxbody {  text-align center;  font-family sans-serif;}.docx
body { text-align center; font-family sans-serif;}.docxmoirarandell
 
Write and run three interesting queries/tutorialoutlet
Write and run three interesting queries/tutorialoutletWrite and run three interesting queries/tutorialoutlet
Write and run three interesting queries/tutorialoutletTitmuss
 
CSCI 2215 — Databases — Fall 2015HW 1, Due Friday, 092515.docx
CSCI 2215 — Databases — Fall 2015HW 1, Due Friday, 092515.docxCSCI 2215 — Databases — Fall 2015HW 1, Due Friday, 092515.docx
CSCI 2215 — Databases — Fall 2015HW 1, Due Friday, 092515.docxfaithxdunce63732
 
Code That Writes Code : Automatic Programming for NHibernate
Code That Writes Code : Automatic Programming for NHibernateCode That Writes Code : Automatic Programming for NHibernate
Code That Writes Code : Automatic Programming for NHibernateDeepak Sahu
 
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and FuncCSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and FuncMargenePurnell14
 
csc3412 Assignment 1Semester 1, 2014Due Date Midnight.docx
csc3412 Assignment 1Semester 1, 2014Due Date Midnight.docxcsc3412 Assignment 1Semester 1, 2014Due Date Midnight.docx
csc3412 Assignment 1Semester 1, 2014Due Date Midnight.docxfaithxdunce63732
 
The Expression Problem - Part 2
The Expression Problem - Part 2The Expression Problem - Part 2
The Expression Problem - Part 2Philip Schwarz
 
2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces 2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces kinan keshkeh
 
Intro To C++ - Class #20: Functions, Recursion
Intro To C++ - Class #20: Functions, RecursionIntro To C++ - Class #20: Functions, Recursion
Intro To C++ - Class #20: Functions, RecursionBlue Elephant Consulting
 
Bt0082, visual basic
Bt0082, visual basicBt0082, visual basic
Bt0082, visual basicsmumbahelp
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfrajeshjangid1865
 
Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7ashhadiqbal
 

Similar to CS 111 - Homework 2 p. 1CS 111 - Homework 2Deadline1.docx (20)

Rspec
RspecRspec
Rspec
 
Bca1020 programming in c
Bca1020  programming in cBca1020  programming in c
Bca1020 programming in c
 
hw1.docxCS 211 Homework #1Please complete the homework problem.docx
hw1.docxCS 211 Homework #1Please complete the homework problem.docxhw1.docxCS 211 Homework #1Please complete the homework problem.docx
hw1.docxCS 211 Homework #1Please complete the homework problem.docx
 
Gráficas en python
Gráficas en python Gráficas en python
Gráficas en python
 
body { text-align center; font-family sans-serif;}.docx
body {  text-align center;  font-family sans-serif;}.docxbody {  text-align center;  font-family sans-serif;}.docx
body { text-align center; font-family sans-serif;}.docx
 
Composer Helpdesk
Composer HelpdeskComposer Helpdesk
Composer Helpdesk
 
Write and run three interesting queries/tutorialoutlet
Write and run three interesting queries/tutorialoutletWrite and run three interesting queries/tutorialoutlet
Write and run three interesting queries/tutorialoutlet
 
CSCI 2215 — Databases — Fall 2015HW 1, Due Friday, 092515.docx
CSCI 2215 — Databases — Fall 2015HW 1, Due Friday, 092515.docxCSCI 2215 — Databases — Fall 2015HW 1, Due Friday, 092515.docx
CSCI 2215 — Databases — Fall 2015HW 1, Due Friday, 092515.docx
 
Code That Writes Code : Automatic Programming for NHibernate
Code That Writes Code : Automatic Programming for NHibernateCode That Writes Code : Automatic Programming for NHibernate
Code That Writes Code : Automatic Programming for NHibernate
 
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and FuncCSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
 
a3.pdf
a3.pdfa3.pdf
a3.pdf
 
csc3412 Assignment 1Semester 1, 2014Due Date Midnight.docx
csc3412 Assignment 1Semester 1, 2014Due Date Midnight.docxcsc3412 Assignment 1Semester 1, 2014Due Date Midnight.docx
csc3412 Assignment 1Semester 1, 2014Due Date Midnight.docx
 
The Expression Problem - Part 2
The Expression Problem - Part 2The Expression Problem - Part 2
The Expression Problem - Part 2
 
2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces 2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces
 
Intro To C++ - Class #20: Functions, Recursion
Intro To C++ - Class #20: Functions, RecursionIntro To C++ - Class #20: Functions, Recursion
Intro To C++ - Class #20: Functions, Recursion
 
Bt0082, visual basic
Bt0082, visual basicBt0082, visual basic
Bt0082, visual basic
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdf
 
محاضرة برنامج التحليل الكمي R program د.هديل القفيدي
محاضرة برنامج التحليل الكمي   R program د.هديل القفيديمحاضرة برنامج التحليل الكمي   R program د.هديل القفيدي
محاضرة برنامج التحليل الكمي R program د.هديل القفيدي
 
Database Management Assignment Help
Database Management Assignment Help Database Management Assignment Help
Database Management Assignment Help
 
Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7
 

More from annettsparrow

Initial Post  (250 words)Read and interpret the short story .docx
Initial Post  (250 words)Read and interpret the short story .docxInitial Post  (250 words)Read and interpret the short story .docx
Initial Post  (250 words)Read and interpret the short story .docxannettsparrow
 
initial post one paragraph intext citation and reference Require.docx
initial post one paragraph intext citation and reference Require.docxinitial post one paragraph intext citation and reference Require.docx
initial post one paragraph intext citation and reference Require.docxannettsparrow
 
Initial Post InstructionsTriggers are ethnocentric responses to .docx
Initial Post InstructionsTriggers are ethnocentric responses to .docxInitial Post InstructionsTriggers are ethnocentric responses to .docx
Initial Post InstructionsTriggers are ethnocentric responses to .docxannettsparrow
 
Initial Post InstructionsFor the initial post,consider thr.docx
Initial Post InstructionsFor the initial post,consider thr.docxInitial Post InstructionsFor the initial post,consider thr.docx
Initial Post InstructionsFor the initial post,consider thr.docxannettsparrow
 
Initial Post InstructionsFor the initial post, choose and ad.docx
Initial Post InstructionsFor the initial post, choose and ad.docxInitial Post InstructionsFor the initial post, choose and ad.docx
Initial Post InstructionsFor the initial post, choose and ad.docxannettsparrow
 
Initial Post InstructionsDiscuss the differences and similaritie.docx
Initial Post InstructionsDiscuss the differences and similaritie.docxInitial Post InstructionsDiscuss the differences and similaritie.docx
Initial Post InstructionsDiscuss the differences and similaritie.docxannettsparrow
 
Initial Post InstructionsAs we jump into the world of Alge.docx
Initial Post InstructionsAs we jump into the world of Alge.docxInitial Post InstructionsAs we jump into the world of Alge.docx
Initial Post InstructionsAs we jump into the world of Alge.docxannettsparrow
 
Initial Post InstructionsFor the initial post, respond to one .docx
Initial Post InstructionsFor the initial post, respond to one .docxInitial Post InstructionsFor the initial post, respond to one .docx
Initial Post InstructionsFor the initial post, respond to one .docxannettsparrow
 
Initial Post InstructionsAgenda setting can be a difficult t.docx
Initial Post InstructionsAgenda setting can be a difficult t.docxInitial Post InstructionsAgenda setting can be a difficult t.docx
Initial Post InstructionsAgenda setting can be a difficult t.docxannettsparrow
 
Initial Post Identify all the components of a cell. Describe the fu.docx
Initial Post Identify all the components of a cell. Describe the fu.docxInitial Post Identify all the components of a cell. Describe the fu.docx
Initial Post Identify all the components of a cell. Describe the fu.docxannettsparrow
 
Initial Discussion Board Post Compare and contrast life for col.docx
Initial Discussion Board Post Compare and contrast life for col.docxInitial Discussion Board Post Compare and contrast life for col.docx
Initial Discussion Board Post Compare and contrast life for col.docxannettsparrow
 
Infrastructure SecurityChapter 10Principles of Compute.docx
Infrastructure SecurityChapter 10Principles of Compute.docxInfrastructure SecurityChapter 10Principles of Compute.docx
Infrastructure SecurityChapter 10Principles of Compute.docxannettsparrow
 
Inital post please respond for the above post question one page with.docx
Inital post please respond for the above post question one page with.docxInital post please respond for the above post question one page with.docx
Inital post please respond for the above post question one page with.docxannettsparrow
 
Infornnation Technologyin Hunnan ResourceAnEmpirical .docx
Infornnation Technologyin Hunnan ResourceAnEmpirical .docxInfornnation Technologyin Hunnan ResourceAnEmpirical .docx
Infornnation Technologyin Hunnan ResourceAnEmpirical .docxannettsparrow
 
INFORMED CONSENT LETTER Page 1 of 2 SELF CONSENT .docx
INFORMED CONSENT LETTER  Page 1 of 2 SELF CONSENT .docxINFORMED CONSENT LETTER  Page 1 of 2 SELF CONSENT .docx
INFORMED CONSENT LETTER Page 1 of 2 SELF CONSENT .docxannettsparrow
 
INFORMATIONGOVERNANCEFounded in 1807, John W.docx
INFORMATIONGOVERNANCEFounded in 1807, John W.docxINFORMATIONGOVERNANCEFounded in 1807, John W.docx
INFORMATIONGOVERNANCEFounded in 1807, John W.docxannettsparrow
 
Informative Presentation Delivery OutlineI. HeaderSpeec.docx
Informative Presentation Delivery OutlineI.  HeaderSpeec.docxInformative Presentation Delivery OutlineI.  HeaderSpeec.docx
Informative Presentation Delivery OutlineI. HeaderSpeec.docxannettsparrow
 
Informed Consent FormBy the due date assigned, submit the Inform.docx
Informed Consent FormBy the due date assigned, submit the Inform.docxInformed Consent FormBy the due date assigned, submit the Inform.docx
Informed Consent FormBy the due date assigned, submit the Inform.docxannettsparrow
 
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docx
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docxINFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docx
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docxannettsparrow
 
Information Technology Capstone ProjectIn this course, learners .docx
Information Technology Capstone ProjectIn this course, learners .docxInformation Technology Capstone ProjectIn this course, learners .docx
Information Technology Capstone ProjectIn this course, learners .docxannettsparrow
 

More from annettsparrow (20)

Initial Post  (250 words)Read and interpret the short story .docx
Initial Post  (250 words)Read and interpret the short story .docxInitial Post  (250 words)Read and interpret the short story .docx
Initial Post  (250 words)Read and interpret the short story .docx
 
initial post one paragraph intext citation and reference Require.docx
initial post one paragraph intext citation and reference Require.docxinitial post one paragraph intext citation and reference Require.docx
initial post one paragraph intext citation and reference Require.docx
 
Initial Post InstructionsTriggers are ethnocentric responses to .docx
Initial Post InstructionsTriggers are ethnocentric responses to .docxInitial Post InstructionsTriggers are ethnocentric responses to .docx
Initial Post InstructionsTriggers are ethnocentric responses to .docx
 
Initial Post InstructionsFor the initial post,consider thr.docx
Initial Post InstructionsFor the initial post,consider thr.docxInitial Post InstructionsFor the initial post,consider thr.docx
Initial Post InstructionsFor the initial post,consider thr.docx
 
Initial Post InstructionsFor the initial post, choose and ad.docx
Initial Post InstructionsFor the initial post, choose and ad.docxInitial Post InstructionsFor the initial post, choose and ad.docx
Initial Post InstructionsFor the initial post, choose and ad.docx
 
Initial Post InstructionsDiscuss the differences and similaritie.docx
Initial Post InstructionsDiscuss the differences and similaritie.docxInitial Post InstructionsDiscuss the differences and similaritie.docx
Initial Post InstructionsDiscuss the differences and similaritie.docx
 
Initial Post InstructionsAs we jump into the world of Alge.docx
Initial Post InstructionsAs we jump into the world of Alge.docxInitial Post InstructionsAs we jump into the world of Alge.docx
Initial Post InstructionsAs we jump into the world of Alge.docx
 
Initial Post InstructionsFor the initial post, respond to one .docx
Initial Post InstructionsFor the initial post, respond to one .docxInitial Post InstructionsFor the initial post, respond to one .docx
Initial Post InstructionsFor the initial post, respond to one .docx
 
Initial Post InstructionsAgenda setting can be a difficult t.docx
Initial Post InstructionsAgenda setting can be a difficult t.docxInitial Post InstructionsAgenda setting can be a difficult t.docx
Initial Post InstructionsAgenda setting can be a difficult t.docx
 
Initial Post Identify all the components of a cell. Describe the fu.docx
Initial Post Identify all the components of a cell. Describe the fu.docxInitial Post Identify all the components of a cell. Describe the fu.docx
Initial Post Identify all the components of a cell. Describe the fu.docx
 
Initial Discussion Board Post Compare and contrast life for col.docx
Initial Discussion Board Post Compare and contrast life for col.docxInitial Discussion Board Post Compare and contrast life for col.docx
Initial Discussion Board Post Compare and contrast life for col.docx
 
Infrastructure SecurityChapter 10Principles of Compute.docx
Infrastructure SecurityChapter 10Principles of Compute.docxInfrastructure SecurityChapter 10Principles of Compute.docx
Infrastructure SecurityChapter 10Principles of Compute.docx
 
Inital post please respond for the above post question one page with.docx
Inital post please respond for the above post question one page with.docxInital post please respond for the above post question one page with.docx
Inital post please respond for the above post question one page with.docx
 
Infornnation Technologyin Hunnan ResourceAnEmpirical .docx
Infornnation Technologyin Hunnan ResourceAnEmpirical .docxInfornnation Technologyin Hunnan ResourceAnEmpirical .docx
Infornnation Technologyin Hunnan ResourceAnEmpirical .docx
 
INFORMED CONSENT LETTER Page 1 of 2 SELF CONSENT .docx
INFORMED CONSENT LETTER  Page 1 of 2 SELF CONSENT .docxINFORMED CONSENT LETTER  Page 1 of 2 SELF CONSENT .docx
INFORMED CONSENT LETTER Page 1 of 2 SELF CONSENT .docx
 
INFORMATIONGOVERNANCEFounded in 1807, John W.docx
INFORMATIONGOVERNANCEFounded in 1807, John W.docxINFORMATIONGOVERNANCEFounded in 1807, John W.docx
INFORMATIONGOVERNANCEFounded in 1807, John W.docx
 
Informative Presentation Delivery OutlineI. HeaderSpeec.docx
Informative Presentation Delivery OutlineI.  HeaderSpeec.docxInformative Presentation Delivery OutlineI.  HeaderSpeec.docx
Informative Presentation Delivery OutlineI. HeaderSpeec.docx
 
Informed Consent FormBy the due date assigned, submit the Inform.docx
Informed Consent FormBy the due date assigned, submit the Inform.docxInformed Consent FormBy the due date assigned, submit the Inform.docx
Informed Consent FormBy the due date assigned, submit the Inform.docx
 
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docx
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docxINFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docx
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docx
 
Information Technology Capstone ProjectIn this course, learners .docx
Information Technology Capstone ProjectIn this course, learners .docxInformation Technology Capstone ProjectIn this course, learners .docx
Information Technology Capstone ProjectIn this course, learners .docx
 

Recently uploaded

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answersdalebeck957
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 

Recently uploaded (20)

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 

CS 111 - Homework 2 p. 1CS 111 - Homework 2Deadline1.docx

  • 1. CS 111 - Homework 2 p. 1 CS 111 - Homework 2 Deadline 11:59 pm on Friday, February 3, 2017 Purpose To practice defining and using named constants, and to practice using the design recipe to write and test functions. How to submit Each time you would like to submit your work: • save your current Definitions window contents in a file with the name 111hw2.rkt – Note: please use that *exact* name -- do not change the case, add blanks, etc. If I search for a file with that name in your submission, I want it to show up! 8-) • transfer/copy that file to a directory on nrs-labs.humboldt.edu (preferably in a folder/directory named 111hw2) – If you are in a campus lab, you can do so by copying them to a folder on the U: drive – If you are not in a campus lab, you can do so by using sftp (secure file transfer) and connecting to nrs-labs.humboldt.edu, and then transferring them.
  • 2. Graphical versions of sftp include WinSCP and Secure Shell Transfer Client for Windows, Cyberduck and Fugu for Mac OS X, and FileZilla that has versions for both Windows and Mac OS X. (Mac OS X and Linux also come with a command-line sftp -- an intro to this is included in the posted handout, "useful details - sftp, ssh, and ~st10/111submit", available on the public course web site in the References section and in the Homework 1 section.) – Whichever version of sftp you are using, use a host name of nrs-labs.humboldt.edu if you are not in a campus lab (you can get away with just nrs-labs for the host name in a campus lab), your campus username, and when you are prompted for it, your campus password. IF you need to give a port number, give a port number of 22. • Now that your file is on nrs-labs.humboldt.edu, you need to log onto nrs-labs.humboldt.edu using ssh, so you can submit your file to me. – In BSS 313, the Windows computers have a graphical version of ssh called PuTTY. There is a graphical version of ssh for Mac OS X named Jelly FiSSH, (although Mac OS X and Linux also come with command-line ssh, and an intro to this is also included in the "useful details - sftp, ssh, and ~st10/111submit" handout.) – Again, whichever version of ssh you are using, use a host name of nrs-labs.humboldt.edu if you are not in a campus lab (you can get away with just nrs-labs for the host name in a campus
  • 3. lab), your campus username, and when you are prompted for it, your campus password. IF you need to give a port number, give a port number of 22. • WHILE you are logged onto nrs-labs: – IF you saved your file in a folder, use cd to change to the folder/directory where you saved it -- for example, if you saved it in the folder 111hw2, then you would go to that directory by saying: CS 111 - Homework 2 p. 2 cd 111hw2 – use the ls command to make sure your 111hw2.rkt file is really there: ls – type the command: ~st10/111submit ...and when asked, enter a homework number of 2 ...and when asked, enter y, you do want to submit all files with an appropriate suffix (I don't mind getting some extra files, as long as I also get 111hw2.rkt; I'd rather receive too many files than too few due to typos.) ...make sure to carefully check the list of files submitted, and make SURE it lists 111hw2.rkt as
  • 4. having been submitted! (The most common error is to try to run ~st10/111submit while in a different directory than where your files are...) • (we practiced the above during the Week 1 Lab, on Friday, January 20 -- ASK ME if this is still not clear, or if you have any problems with submission! If you get stuck, E-MAIL me your 111hw2.rkt file as an e-mail attachment before the deadline, AND then ALSO submit it as soon after that as you are able.) – I am happy to walk through submitting files with you -- just come by my office during office hours, or e-mail me to set up an appointment. Important notes • Signature and purpose statement comments are ONLY required for function definitions -- you do NOT write them for named constants or for non-function-definition compound expressions. • Remember: A signature in Racket is written in a comment, and it includes the name of the function, the types of expressions it expects, and the type of expression it returns. This should be written as discussed in class (and you can find examples in the posted in-class examples). For example, ; signature: purple-star: number -> image • Remember: a purpose statement in Racket is written in a comment, and it describes what the function expects and describes what the function returns (and if the function has side-effects, it also describes those side-effects). For example, ; purpose: expects a size in pixels, the distance between
  • 5. ; points of a 5-pointed-star, and returns an image ; of a solid purple star of that size • Remember: it is a COURSE STYLE STANDARD that named constants are to be descriptive and written in all-uppercase -- for example, (define WIDTH 300) • You should use blank lines to separate your answers for the different parts of the homework problems. If you would like to add comments noting which part each answer is for, that is fine, too! • Because the design recipe is so important, you will receive significant credit for the signature, purpose, header, and examples/check-expects portions of your functions. Typically you'll get at least half-credit for a correct signature, purpose, header, and examples/check- expects, even if your function body is not correct (and, you'll typically lose at least half-credit if you omit these or do them poorly, even if your function body is correct). CS 111 - Homework 2 p. 3 Problem 1 Start up DrRacket, (if necessary) setting the language to How To Design Programs - Beginning Student level, and adding the HTDP/2e versions of the image and universe teachpacks by putting these lines at the beginning of your Definitions window: (require 2htdp/image) (require 2htdp/universe)
  • 6. Put a blank line, and then type in: • a comment-line containing your name, • followed by a comment-line containing CS 111 - HW 2, • followed by a comment-line giving the date you last modified this homework, • followed by a comment-line with no other text in it --- for example: ; type in YOUR name ; CS 111 - HW 2 ; last modified: 2017-01-30 ; Below this, after a blank line, now type the comment lines: ; ; Problem 1 ; And PLEASE NOTE -- you are not defining ANY new functions in this problem, you are practicing writing and using a named constant, and practicing writing some check- expect compound expressions. 1 part a Remember the image you created for Homework 1, Problem 7? Write a Racket define expression to define a named constant whose value is that image. NOTE: You are probably more familiar with more image operations now than you were when completing Homework 1 -- as long as you still meet the requirements from Homework 1, Problem 7, you can change your image IF you would like. If you do create a different image, I will use Homework 2's version in the
  • 7. "class quilt" unless I hear from you otherwise. As a reminder, here are those requirements: • the final resulting image somehow should be the result of at least THREE different image or image- related operations from the 2htdp/image teachpack. (More is fine!) – They can be image operations from the "Some DrRacket Tidbits" handout, OR they can be image operations (from the 2htdp/image teachpack) that you find by exploring DrRacket's Help feature, described a bit at the end of the "Some DrRacket Tidbits" handout. • the final resulting image should be an expression of type image that is precisely 200 pixels wide and 200 pixels high – You might ask -- how can I be SURE my final image is the right size? The function image-width expects an image arguments, and returns its width in pixels -- and the function image-height expects an image argument, and returns its height in pixels. So, you can use these functions to check the width and height of your final image, IF you would like. CS 111 - Homework 2 p. 4 • ACCEPTABLE "extended" version of this problem: IF you would like to use define to also give names to some ADDITIONAL expressions to make your task easier, that is allowed and encouraged (but not
  • 8. required) for this problem. • As long as you meet the above requirements, your image may be as simple or as complex as you would like. 1 part b Recall that Homework 1, Problem 7 specified that this image needed to be "precisely 200 pixels wide and 200 pixels high". You're now going to test that this is the case. Recall that operation image-width expects an image and returns its width in pixels, and that operation image-height expects an image and returns its height in pixels. Write TWO check-expect expressions: • Write a check-expect expression, using image-width and your named constant from Problem 1 part a, that will pass if your named constant image is indeed 200 pixels wide. • Then, write a second check-expect expression, using image- height and your named constant from Problem 1 part a, that will pass if you named constant image is indeed 200 pixels high. (What if you find out your image isn't 200 x 200 pixels? Then you should modify your named constant definition in Problem 1 part a so that it is.) Problem 2 Next, in your definitions window, after a blank line, type the comment lines: ; ; Problem 2 ;
  • 9. Now, you are defining a new function! Consider a function that is to return the perimeter of a square. 2 part a How many and what type of expressions should such a function expect, to be able to return such a perimeter? Decide on a good, descriptive name for this function, and write an appropriate signature comment for this function. 2 part b Write an appropriate purpose statement comment for this function. 2 part c Write an appropriate function header for this function (putting ... ) for its body for now). 2 part d Write at least 2 specific tests/check-expect expressions for this function. Interestingly, you may actually place these either before or after your not-yet-completed function definition, whichever you prefer. CS 111 - Homework 2 p. 5 2 part e Only NOW should you replace the ... in the function's body with an appropriate expression to complete this function. Run and test your function until you are satisfied that it passes
  • 10. its tests and works correctly. Finally, include at least 2 example calls of your function (such that you will see their results) after your function definition. Problem 3 Next, in your definitions window, after a blank line, type the comment lines: ; ; Problem 3 ; Consider a function that asks a given person how their day is going. Given a person's name, it returns How's it going, ...that person's name... ? (Optionally, you may change the exact wording of the question, as long as it includes the person's name and ends with at least one question mark.) 3 part a How many and what type of expressions should such a function expect, to be able to return this question? Decide on a good, descriptive name for this function, and write an appropriate signature comment for this function. 3 part b Write an appropriate purpose statement comment for this function. 3 part c Write an appropriate function header for this function (putting
  • 11. ... ) for its body for now). 3 part d Write at least two specific tests/check-expect expressions for this function, placed either before or after your not-yet-completed function definition, whichever you prefer. 3 part e Only NOW should you replace the ... in the function's body with an appropriate expression to complete this function. Run and test your function until you are satisfied that it passes its tests and works correctly. Finally, include at least 2 example calls of your function (such that you will see their results) after your function definition. Problem 4 Next, in your definitions window, after a blank line, type the comment lines: ; CS 111 - Homework 2 p. 6 ; Problem 4 ; You decide it would be useful to be able to take some title text and an image, and create a new image that includes the given title above that image, such that the title text
  • 12. is depicted in 25-pixel-high black letters that are actually part of the image. 4 part a Decide on a good, descriptive name for this function, and write an appropriate signature comment for this function. 4 part b Write an appropriate purpose statement comment for this function. 4 part c Write an appropriate function header for this function (putting ... ) for its body for now). 4 part d Write at least two specific tests/check-expect expressions for this function, placed either before or after your not-yet-completed function definition, whichever you prefer. 4 part e Only NOW should you replace the ... in the function's body with an appropriate expression to complete this function. Run and test your function until you are satisfied that it passes its tests and works correctly. Finally, include at least 2 example calls of your function (such that you will see their results) after your function definition. Problem 5 Next, in your definitions window, after a blank line, type the
  • 13. comment lines: ; ; Problem 5 ; Consider a function total-inches that expects a number of feet and a number of inches, and returns the total number of inches. (For example, the value of the expression (total-inches 4 5) should be 53, because 4 feet and 5 inches is 53 inches overall.) 5 part a This part comes BEFORE starting function total-inches! FIRST: write a Racket definition for a named constant that will define the name IN-PER-FT to be the number of inches in a foot. (IN-PER-FT is NOT a function! It is just a number, the number of inches in a single foot.) CS 111 - Homework 2 p. 7 5 part b NOW you are starting the design recipe for function total- inches. NOW, write an appropriate signature comment for the function total-inches. 5 part c Write an appropriate purpose statement comment for total- inches. 5 part d Write an appropriate function header for total-inches (putting ...
  • 14. ) for its body for now). 5 part e Write at least two specific tests/check-expect expressions for total-inches, • at least one for a number of feet of 0, and • at least one for a number of feet greater than 1, • (each with a DIFFERENT number of inches), ...placed either before or after your not-yet-completed function definition, whichever you prefer. 5 part f Only NOW should you replace the ... in total-inches's body with an appropriate expression to complete it. For full credit, make sure that you use the named constant IN-PER-FT appropriately within this expression. Run and test your function until you are satisfied that it passes its tests and works correctly. Finally, include at least 2 example calls of your function (such that you will see their results) after your function definition. Problem 6 Next, in your definitions window, after a blank line, type the comment lines: ; ; Problem 6 ; (This is adapted from Homework 1 of J. Marshall's "The Way of
  • 15. the Program" course at Sarah Lawrence College.) The Tasty-Waking coffee roasters sells whole-bean coffee at $8.95 per pound plus the cost of shipping. Each order ships for $0.85 per pound plus $2.25 fixed cost for overhead. (So, if someone buys 1 pound of their whole-bean coffee, the total price is $12.05; if someone buys 2 pounds of their whole-bean coffee, the total price is $21.85; if someone buys 5 pounds, the total is $51.25.) 6 part a The description above includes three constant, unchanging values. Define an appropriate, descriptive named constant for each of these values. CS 111 - Homework 2 p. 8 6 part b Now consider a function order-price whose purpose is to calculate the total price for an order. Given that you already know the values for the named constants given in Problem 5 part a, how many and what type of additional expressions should such a function expect, to be able to calculate the price of a coffee order? Write an appropriate signature comment for order-price. (Hint: don't include named constants in the signature! Only consider what the function needs BESIDES the named constants to complete the task.) 6 part c
  • 16. Write an appropriate purpose statement comment for this function. 6 part d Write an appropriate function header for this function (putting ... ) for its body for now). (Hint: remember that named constants do not belong in a function header, either.) 6 part e Write at least two specific examples/tests/check-expect expressions for this function, placed either before or after your not-yet-completed function definition, whichever you prefer. 6 part f Finally, replace the ... in this function's body with an appropriate expression to complete it. For full credit, make sure that NOW you use the named constants from 5 part a appropriately within this expression. Run and test your function until you are satisfied that it passes its tests and works correctly. Finally, include at least 2 example calls of your function (such that you will see their results) after your function definition. Problem 7 Next, in your definitions window, after a blank line, type the comment lines: ; ; Problem 7 ;
  • 17. Decide on a function that will take one or more parameters and return an image as a result. It can be anything not yet written in class or on a previous homework problem (variations on functions done in class or a homework problem are fine). 7 part a Decide on a good, descriptive name for your function, and write an appropriate signature comment for this function. 7 part b Write an appropriate purpose statement comment for this function. CS 111 - Homework 2 p. 9 7 part c Write an appropriate function header for this function (putting ... ) for its body for now). 7 part d Write at least two specific tests/check-expect expressions for this function, placed either before or after your not-yet-completed function definition, whichever you prefer. 7 part e Only NOW should you replace the ... in the function's body with an appropriate expression to complete this function. Run and test your function until you are satisfied that it passes
  • 18. its tests and works correctly. Finally, include at least 2 example calls of your function (such that you will see their results) after your function definition. DeadlinePurposeHow to submitImportant notesProblem 11 part a1 part bProblem 22 part a2 part b2 part c2 part d2 part e Problem 33 part a3 part b3 part c3 part d3 part eProblem 44 part a4 part b4 part c4 part d4 part eProblem 55 part a5 part b5 part c5 part d5 part e5 part fProblem 66 part a6 part b6 part c6 part d6 part e6 part fProblem 7 7 part a7 part b7 part c7 part d7 part e