CS-140 Fall 2017 Practice Lab Test

Today, we are doing a practice lab test. Today's work will be evaluated by the TA's, and you will get feedback telling you what your grade would have been were this exercise graded, but the evaluation will not be counted in your grade. Today is for your benefit alone, to understand how lab tests work, and to learn about what you need to study.

Ground Rules

In lab tests, the rules are slightly different than normal labs, as follows:

To Do

Download file labPT.zip into your cs140 directory on the Linux Lab machine. Then run the command: unzip labPT.zip. This will create a labPT sub-directory. Run cd labPT to move to that directory. This directory is set up like we have been discussing, including .java files in the current directory, and .class files in a labPT sub-directory of the current directory. In order to get instructions for your practice test, you must then run java -cp . labPT.Problem. The Problem class file is contained in ./labPT/Problem.class, but I have not included the Problem.java file in the current directory. The Problem class main method is set up to check to make sure it is during your lab period, and check to make sure you are running on a Linux Lab machine. If so, it will print instructions for the problem to work on. Notice that different students will get different problems, so you will not be working on the same problem as the student next to you, or the student in the next lab section. All problems are of equal difficulty.

Code your Class

The instructions will ask you to create a new java class, and will describe the methods and fields required to make that class work. To make things easy, I've asked that you include a main method in this class so you can test your class and make sure it works.

Creating a zip file for submission

Change directories to the parent of the labPT directory that contains all of your source code. Then create a zip file with your source code, using the following command:

  > zip -r labPT_<userid>.zip labPT
where <userid> is your bmail user id. This will create a file called labPT_<userid>.zip that contains all of your source files. Please double check and make sure you .java files are in the zipped submission file! Now, go to MyCourses using your web browser, open the CS-140-B1 course, click on "Content"; then "Lab assignments" and then "Lab 04 Practice Test Submission" and upload your zip file.


This practice test would be worth 30 points. You will get the full 30 points if your code compiles without warnings, and produces the correct output. The following are reasons for deductions:

There is one special condition... if you handle that condition correctly and you had other deductions, 2 extra credit points will be added.