CS 111: Fundamentals of Programming 1

Lab 1

Goals

The goals for this lab are learn how to

Step 1 - Linux Environment

Read and follow the instructions on the handout - An Introduction to Linux for New Users

Step 2 - Logging On

  1. Follow the instructions on the handout to log on to the CS network.
  2. Now follow the instructions from the web page to change your password to something easy to remember.

Step 3 - Copy Lab1 folder

  1. Double click on your Home icon on your desktop. This opens your home directory on the CS server.
  2. Now create a new folder in your home directory and name it Labs.
  3. From the Main menu in the tray at the bottom of your screen, go to Programs, then CompSci Courses, and then Course Files.
  4. Now open the CS111 folder and open the Labs folder within it.
  5. Now click on the Lab1 folder with the right mouse button and take Copy file.
  6. Now open the Labs folder in your home directory and use the right mouse button to paste the copied folder there.

Step 4 - Working with BlueJ - Executing the Convert program

  1. Click on the BlueJ icon in the tray at the bottom of your desktop. This will take a few seconds for BlueJ to open up. I will refer to the window you see now as the "main" window.
  2. Under the Projects menu, select the Open Project option.
  3. Navigate into the Lab1 folder and open the Convert project.
  4. Now right click on the Convert icon in the main window and take the Open Editor option to see the Java code. I will refer to this window as the "editor" window.
  5. Now click the Compile button to have BlueJ compile the program. Hopefully there will be no errors reported.
  6. Now back in the main window, right click on Convert and take the "void main(args)" option.
  7. Now click ok to execute the program. A "terminal window" should come up. Type in a Fahrenheit temperature and hit the Enter key.

Step 5 - Errors and Error Messages

  1. We will now intentionally put errors into the Convert program to see how the system responds. First go to the editor window and remove the semi-colon at the end of the first writer.print statement. Now hit the compile button. On the Worksheet, tell what happened - both the message and what happened in the edit window itself. Put the semi-colon back where it was.
  2. If we put // on a line, the rest of the line is treated as a comment and is ignored. Try this now by putting a double slash at the beginning of the second writer.print statement. Click the compile button. Report what happened on the Worksheet.
  3. Now execute the program as before and report what change you notice.
  4. Remove the // slash and put // at the beginning of the import statement. Try to compile and report what happens. Can you explain the message you get? Now remove the //.
  5. Now in the first writer.print statement, change "writer" to "Writer". Try to compile and report what happens. Change back.
  6. Change the 5.0 to 5 and the 9.0 to 9 and test the program to see if any change occurs. Report your findings. Change back.
  7. Now add parentheses to form (5.0 / 9.0) and test the program to see if any change occurs. Report your findings.
  8. Keeping the parentheses from the previous step, change 5.0 to 5 and 9.0 to 9. Test the program again and report your findings. Now go to the Project menu and close the project.

Step 6 - Turn in your work.

Before leaving

  1. Give me your Worksheet.
  2. Use the right mouse button to copy your Lab1 folder.
  3. From the Main menu at the bottom go to Programs then CompSci Courses then Turnin Folders and the appropriate course according to your lab section. Open your own turnin folder and paste your Lab1 folder there.
  4. Log off