Professional Documents
Culture Documents
Summer 2008
Due Friday June 27, 2008, 10:00PM
0 Introduction
0.1 Goals
This assignment will help you refresh your knowledge of Java and/or learn Javas syntax. It is roughly a
comprehensive review of CS100. In addition it will help you practice using some concepts we will discuss in
the first few days of class, such as recursion.
0.2 Instructions
Be sure to read the entire assignment before answering the questions! Do all the tasks in the following
sections. In later assignments, we will not necessarily repeat the blitz of instructions in Section 0.
0.4 Submission
Follow the Submission Requirements on the course website. The last section of this assignment summarizes
the files that you need to submit on CMS.
0.5 Grading
All code that you submit must run without warnings or errors. Otherwise, you will receive a zero for that
portion of the assignment. The assignment will be graded out of 100 points and is worth 10% of your course
grade.
0.6 Advice
Start early! For a Java refresher and help with using its command-line environment, refer to the bootcamp
notes (available on the website). You may also read the first three chapters of the textbook for a Java review.
Remember to use good programming style. Review the style guidelines set out on the course website.
In particular, use meaningful variable and method names. Add comments to clarify your code, and include
a comment at the top of the source file that includes your name, NetId, the date, and a brief description
of your solution. Correct solutions that are short, simple, and efficient are superior to submissions that are
unnecessarily long, complex, or slow.
1 Communication
Purpose: To get connected
Points: 2
Review the information about Usenet on the course website. In your favorite newsreader, subscribe to
cornell.class.cs2110 and cornell.class.cs2110.talk. Post a message in cornell.class.cs2110.talk.
1/7
CS2110 Assignment 1, Summer 2008 100 points 2/7
In the subject line, enter only A1:<your Cornell NetId> . In the message body write something witty. (If
youre not in a witty mood, writing Hello world! will suffice.)
Recall that the newsgroup cornell.class.cs2110.talk is meant for test posts and casual conversation
on topics related to 2110. The newsgroup cornell.class.cs2110 is the actual course newsgroup that we
reserve for technical questions regarding course material.
You may ignore this until the newsgroup starts working again. When it works it will be announced in
class and on the website.
Review the entire course website and answer the following questions.
1. How long do you think it will take to do this assignment? How long did it actually take?
2. What version of Java should you use?
3. What are the dates and times of the CS2110 exams?
4. What is the procedure to submit a regrade for an assignment?
5. Suppose Alice, a CS2110 student, writes some of the solutions for a particular assignment with a
partner named Bob. Then, the two students divorce because of irreconcilable differences and wish to
work alone or perhaps with other partners for the remainder of the current assignment. According
to the 2110 rules of academic integrity on the course website, may Alice and Bob divorce? May they
divorce for the remaining assignments?
6. Suppose that about two days before an assignment deadline, another student who is not your partner
pleads with you to share some of your code for the assignment. According to the course website, under
what conditions may you show your groups code to him or her?
7. Where is the CS2110 consulting office?
8. Where can copies of the optional textbooks be found?
Submit your answers in a plain text file called problem2.txt. If we cannot open the file with a text editor,
you will receive no credit. If you do not know what plain text is, refer to the submission format requirements
on the website.
3 Computing grades
Purpose: Basic Java syntax, keyboard input, error checking and exceptions, course grading policies
Points: 40
Imagine the future. Specifically, six weeks into the future. Youve just completed all of the CS 2110
coursework and youre anxious to know your overall course score and letter grade. Write a program called
GradeCalc that asks for your scores on the individual 2110 coursework items and outputs your overall course
score. The program should also output the minimum letter grade that you are guaranteed by that course
score.
The program must be user-friendly. It should ask the user to input scores for assignments, quizzes, and
exams. Part of this problem is to get practice writing programs that are robust to user input errors, so you
should check user input for errors, such as a score that is too high or too low (one of many possible input
errors). If an error is detected, the program should print a helpful message and allow the user to try again.
CS2110 Assignment 1, Summer 2008 100 points 3/7
You should begin this assignment by reviewing the course grading policies set out on the website. For
the purpose of this assignment, assume that six quizzes are given but that the lowest quiz score is dropped.
You can assume that scores on individual coursework items are integral (i.e. no fractional points are given).
Also assume that extra credit is not given. For homework assignments, the program should ask whether the
homework was submitted on-time, during the late submission period, or after the late submission period,
and adjust the grade accordingly.
Here is a sample of what an interactive session might look like:
-----------------
Your final course score: 81.8
Your letter grade will be at least: B
Due to the increasing global demand for soybeans this year, Farmer Munson decided to plant three fields
of soybeans. Unfortunately, the cost of chemical fertilizers is twice as much this year as last year due to the
increasing price of natural gas. Ever resourceful, Farmer Munson decided to try using some organic fertilizer
being sold by his friend Old MacDonald. (The fertilizer comes from MacDonalds chickens; the farmers have
a colorful name for it that we wont repeat here.)
Farmer Munson planted 1 field using chicken fertilizer and 1 field using chemical fertilizer (Munson
found some leftovers at the back of his storage shed). After hearing about this natural experiment, Professor
Cornellia from Cornells Agriculture School convinced Munson to plant the last field without fertilizer to get
an idea of crop yield without fertilizer. In return, she agreed to pay Munson the profit difference between
field 3 and field 1.
Last week Cornellia went to the fields and measured some heights of the fledgling soybean plants in each
of the fields to see what, if any, growth differences there were. Here are a few of the measurements:
6 6 3
12 7 6
11 14 3
9
Is the chemical fertilizer better than the organic fertilizer? How strong is the evidence that fertilizer (of
either kind) produces taller soybean plants (vs plants without fertilizer)?
Cornellia wants to support her conclusions with tests of statistical significance. Unfortunately, she does
not know anything about how soybean heights are distributed, and she only measured a few plants (it started
to rain). She asks you to help her test her hypotheses using a permutation test.
For this problem you will write a program that tests a hypothesis using a permutation test (details below).
To help you, we have prepared an incomplete solution which you should use as the basis for your work. You
can download the incomplete solution through CMS. There are detailed comments in these files that will
hopefully clarify anything that is confusing.
Your task is to add code to the incomplete solution in order to make it work properly. The instructions in
the next two sections will help you do this. You may add code (including new methods and/or new member
variables), but you must not change the public interface of any classes. Exception: you may add a main()
method to a class to do unit testing of the class independent of the rest of the program.
is the probability of seeing such a large test statistic value when the group assignments are random. This
probability is often called the p-value.
If the p-value is small, we can reject the null hypothesis as being very unlikely. For example, if the p-value
is 0.05, then the difference is real at the 95% confidence level.
5 What to submit
Submit the following files:
1. problem1.txt
2. GradeCalc.java
3. Labeling.java
4. PermTest.java