Programming Assignment Checklist: Conditionals and Loops


Goals

The goal of Assignment 1 is to write several short programs so that you get accustomed to:

Frequently Asked Questions

What preparation do I need before beginning this assignment? Read Sections 1.2 and 1.3 of the textbook. Read Sections 1.3 and 1.4 of the textbook. You may also find it instructive to work through some of the other exercises and look at the solutions on the booksite afterwards.

How should I format my Java code? How much do I need to comment my code? Follow the style guideline in the Assignment FAQ. Be sure to use the prescribed header in every file you submit.

I have the magic numbers 6, 10, 51, 60, and 61 sprinkled through my TenDice program. Is there a better way? Yes.

These two steps will make your code easier to read, maintain, and debug.

Do I have to use command-line arguments to read the inputs? Yes, or you will lose a substantial number of points.

My output from RGBtoCMYK is almost the same as the sample on the assignment page. Only the last digit or two is different. Why is there this tiny discrepancy, and is my answer wrong? Computers work with limited precision, and so different algebraically equivalent solutions can give slightly different answers. When grading, we typically ignore such tiny discrepancies.

The assignment FAQ says that we should handle all "meaningful" inputs What does that mean for RandomWalkers.java? The number of steps n is a non-negative integer and the number of trials is a positive integer. Of course, if either n or trials is huge, then your program might not finish in a reasonable amount of time.

Possible Progress Steps

These are purely suggestions for how you might make progress. You do not have to follow these steps. The key to writing correct programs is to develop them incrementally, testing and debugging after each step.

Noon snooze. The integer division and remainder operators are the key to solving NoonSnooze.java.

A drone's flight. This is similar in many ways to the gambler's ruin example from the lecture video and textbook. The key to building a larger program is developing it incrementally.

Dice and the Gaussian distribution.

Enrichment

Here are some famous and not-so-famous quotations about learning to program.