Colorado State University

Recitation R2 - Eclipse
Fall 2013

CS160: Foundations in Programming


The purpose of this lab is to learn the basics of using the Eclipse IDE and Java:

Using Eclipse

Eclipse makes beginning programming easier by compiling and running your programs in a single step. Your TA will go over setting up Eclipse and your workspace.
Your TA will guide you in creating a project called P1 and class for starting the P1.

Program Submission via Checkin

Your TA will now walk through logging in to the course website, submitting your code, and viewing preliminary test results.

Remember that this was just setting up for P1 and that there is still more to do before it is complete.
Show your P1.java program to the TA to get credit for this portion of the lab.

Java Programming

Create a new Java Project named R2, and make a class named R2. Your GTA will help you to print out the values of the following mathematical expressions: NOTE: Remember to use System.out.println( ) to print out the values of the expressions.

Initially you can use numeric constants in the print statements, but before you complete the program add the integer and double variables and use them in the computation. For example:

int var1 = 12;
int var2 = 7;
double var3 = 7.0;
double var4 = 12.0;


In a comment block at the bottom of your program, answer the following questions:
  1. Explain the difference (or lack of it) in the result of 12 / 7, 12.0 / 7.0 and 12.0 / 7.
  2. Explain the difference (or lack of it) in the result of 3 - 7 * 6 and (3 - 7) * 6.
  3. Explain the result of 0.1 + 0.2 - 0.3

Show your R2.java program to the TA for grading and submit to RamCT to get credit for this lab.

© 2013 CS160 Colorado State University. All Rights Reserved.