Machine Problem 1, due Sept. 11

Part of the homework for CS:2820, Fall 2017
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Step 1: Log onto the CLAS linux server

Step 2: Get a copy of mp1.java by executing the following shell command:

   [HawkID@serv15 ~]$ cp ~dwjones/mp1.java mp1.java

(Explanation: The cp shell command means copy. It takes two arguments, the source and destination file names. In this case, the source file name is long because you're copying from a different user's directory, mine, while the destination file name is short, mp1.java in whatever is your current directory at the time you make the copy.)

Step 3: Edit your copy of mp1.java so it claims you as an author. Your @author tags must give your name, formatted as it is in the University's records, followed by your section number (A1, A2, B10, or B11).

The official Javadoc web pages say that "multiple @author tags should be listed in chronological order, with the creator listed at the top." You must follow this rule.

It is unethical to delete the record that someone was an author of a file or to claim authorship without acknowledging others you know to be authors. Deletion of authorship claims will be considered to be academic misconduct. Equally, if you edit a file, you are entitled to claim authorship of the changes you made. In the case of this class, a properly formed Javadoc @author tag with your name must be included in every Java source file you edit.

When you edit a large pre-existing source file, do not mix styles. Either make your changes match the existing style of that file or laboriously go through the file to change its style to match your style. Note that Oracle publishes extensive style guidelines. You will not be faulted for following them. They are not exactly the same as the style guidelines I use, but we agree on a number of points.

Step 4: Edit the @version tag to indicate the date at which you made your changes.

Step 5: The call to System.out.println() outputs my name. Change it so it outputs your name and section, formatted identically to the form you used on the @author tag. Do not change other parts of the output generated by that line.

Step 6: Edit the calls to System.err.println() so that they output useful error messages. This means that you must explore the behavior of the program enough to understand what errors you can make.

Those are the only changes you should make to the code! Half the point of this exercise is to show that you can make changes to a Java file without breaking it or making unnecessary changes.

Step 7: Compile your Java program with this command:

   [HawkID@serv15 ~]$ javac mp1.java

If you made no errors, there will be no error messages. If you made errors, the error messages always indicate the source file name and the line number, as well as a shippet of text. It may be faster to go back to step 2 than to try repairing any damage you made.

Step 8: Run the program with this command:

   [HawkID@serv15 ~]$ java mp1

And then run the program with this command and others to explore how the program responds to its arguments.

   [HawkID@serv15 ~]$ java mp1 some arguments

Step 9: Check the format of the file with this command:

   [HawkID@serv15 ~]$ ~dwjones/format mp1.java

This will detect a number of common defects in input files. It produces no output unless it detects over-length lines, trailing spaces, spaces that might be hiding under tabs, unexpected non-printing characters or similar problems. It is particularly useful after moving files from a DOS/Windows environment where the standard text formats differ somewhat from the formats used on Unix/Linux systems.

Step 10: To submit your work, it must be in a file named mp1.java in your current directory on the CLAS Linux system, and you must know your section number. In the following, what you type is shown in bold face. Begin at the linux command-line prompt:

   [HawkID@serv15 ~]$ submit mp1.java

The system will respond by prompting you (badly) for the course number:

   Course (22C:016 would be c_016): CS2820

The system will respond by listing the places you can submit. Pick the one that corresponds to your section and the machine problem number:

   Possible submit directories for /group/submit/CS2820 are:

   mp1/0A01
   mp1/0A02
   mp1/0B10
   mp1/0B11

   Choice:   mp1/0A01

The system will respond with a confirmation that your submission has been accepted (unless you made a mistake), and then it will return to the command-line prompt:

   * File/directory mp1.java has been 
   *  copied to /group/submit/CS2820/mp1/0A01/mp1.java.HawkID.
   [HawkID@serv15 ~]$

The confirmation message saying that the file has been copied tells you that the submission was successful. You may resubmit as many times as you want; each time you resubmit, your previous submission of that file will be deleted. The completed dialogue on your screen will look like this when you are done:

   [HawkID@serv15 ~]$ submit mp1.java
   Course (22C:016 would be c_016): CS2820
   Possible submit directories for /group/submit/CS2820 are:
   
   mp1/0A01
   mp1/0A02
   mp1/0B10
   mp1/0B11

   Choice:   mp1/0A01
   * File/directory mp1.java has been 
   *  copied to /group/submit/CS2820/mp1/0A01/mp1.java.HawkID.
   [HawkID@serv15 ~]$

The output saying "File ... has been copied ..." is your confirmation of successful submission. In the event of insurmountable trouble, do not delete or edit files you have submitted. It is safe to make copies if you want to keep playing with them. Keep the original on the CLAS Linux system until your graded work is returned. This way, the time stamp marking the time of last edit is a trustworthy indicator of whether you did the work on time.

Historically, students unable to successfully complete MP1 for this course have an extraordinarily low chance of success in the course. If this assignment proves daunting, seek help early.