Programming Assignment Checklist: Hello World

Questionnaire

Did you remember to fill out the brief questionnaire?

Goals

Regardless of the operating system that you choose, the goal of Assignment 0 is to make sure that you can:

Frequently Asked Questions

What's a checklist? The programming assignment specifies the general programming assignment. The checklist contains supplemental information, and you are expected to read it prior to submitting your work. Some examples include: links to any preliminary code, a readme.txt template, hints, and frequently asked questions.

What preparation do I need to complete this assignment? Read Section 1.1 and 1.2 of the textbook. If you don't understand something, post a Piazza question or visit your preceptor for assistance. Don't be bashful about asking for help.

Can I use the booksite instead of the textbook? No, the booksite is a super-condensed version of the textbook; it is suitable for reference while online (for example, while programming). The textbook is intended for use when initially learning new material and when reinforcing your understanding of that material (for example, when reviewing for an exam).

How can I download a program from the textbook? The corresponding section in the booksite contains links to all of the Java programs in the textbook. The link goes to a .java.html file (such as UseArgument.java.html) that is suitable for display in a browser. You can copy-and-paste the code into DrJava as needed. The .java.html file also contains a link to the .java file (such as UseArgument.java); you can right click this link and save the file to your computer.

I don't understand all of the jargon in HelloWorld.java. Should I drop the course? Don't worry—we'll discover the meaning of everything in the program over the course of the term. Java just needs a lot of boilerplate to get started. Do the readings and bring any lingering questions to precept.

Do I have to use DrJava? No, feel free to use any development environment you like.

How should I read in user input? Use command-line arguments as specified in the assignment and described in Section 1.2 of the textbook. You will receive a significant deduction for not following directions. We will learn about more general ways to handle user input in Section 1.5.

How do I get Java to print true or false without an if-else statement? If b is a boolean variable, then System.out.println(b) will print true or false according to its value.

How do I open a plain text file, such as readme.txt? In DrJava, select File -> Open; select the desired directory; choose All Files under File Format.

What program should I use to edit the readme.txt file? Use DrJava. Be careful to save the file as readme.txt and not as a .java file. The readme.txt file must be a plain text file—Microsoft Word .doc or .docx formats and Mac TextEdit .rtf formats are unacceptable.

What's Dropbox? Dropbox is the web-based system you will use to submit assignments. Every assignment has a link to its own dropbox. Look on the Assignments page, in the submit column. You can also go to the general dropbox page via https://dropbox.cs.princeton.edu. Either way, you will need to login.

When I login to Dropbox, my browser asks me whether I should accept a "security certificate." How should I proceed? Accept it permanently. We need to establish a secure connection so that you can submit assignments with reasonable privacy.

When I submit HelloWorld.java, Dropbox does not seem to accept it. Why not? Be sure the file is named HelloWorld.java. The capitalization and .java extension are important. Also, be aware that DrJava creates backup files with a .java~ extension, so be sure that you don't submit these. If you use Windows, we recommend configuring your system to unhide the filetype extensions.

In GreatCircle I understand to use Math.toRadians() and Math.toDegrees(). What about the trigonometric functions? See the Math API on p. 716 for useful math functions and constants.

My output from GreatCircle is almost the same as the sample on the assignment page. Only the very last digit is different. Why is there this tiny discrepancy, and is my answer wrong? Did you multiply by 60 (to convert the arc to nautical miles) before or after you converted the arc from radians to degrees? Computers work with limited precision, as the Scientific Computing lecture will explain, and so different algebraically equivalent solutions can give slightly different answers. In grading we ignore such tiny discrepancies (except for certain assignments later where we explicitly tell you otherwise).

Submission

Submission. All assignments submissions are electronic, using Dropbox. We do not accept email or hardcopy submissions. Here are some guidelines.

Programming Style

This is a partial list. See Booksite Appendix B for a fuller explanation.

  • Efficient and clear code: This will be more important as we write more complicated programs. This week it includes ideas like
  • Follow directions. If an input is listed as an integer, read it into an integer data type. Follow output formats exactly.
  • Use descriptive variable names.

    Enrichment

    Here is Hello World in over 200 different programming languages.