Michele Weigle - COMP 14 - Spr 04 COMP 110 Recitation Catie Welsh January 14, 2011 MWF 1-1:50 pm Sitterson 014 1
Michele Weigle - COMP 14 - Spr 04 Announcements HW0 Grades are posted on Blackboard If you do not have a grade and thought you submitted the hw, please email me. No class on Monday No office hours on Monday 2
Office Hours Monday office hours will be 10am-11am If you still cannot make it to either office hour, email me to set up an appointment if you need help with an assignment.
Michele Weigle - COMP 14 - Spr 04 Sample Java Program p.15 import java.util.*; public class FirstProgram { public static void main(String[] args) { System.out.println("Hello out there."); System.out.println("I will add two number for you."); System.out.println("Enter two whole number on a line:"); int n1, n2; Scanner keyboard = new Scanner(System.in); n1 = keyboard.nextInt(); n2 = keyboard.nextInt(); System.out.println("The sum of those two numbers is"); System.out.println(n1 + n2); } } Asks user for two numbers Outputs sum of two numbers Walk you through program Do not expect to understand everything Stop me if you are confused We will see all of this again and it will make sense 4
Today’s Recitation Work in groups of 2-4 people Make sure everyone has a working copy of Eclipse In Eclipse: Create a new java project (File/New/Java project) Name it program1 Select program1 in PackageExplorer, then click File/New/Class. Name your class FirstProgram Type in FirstProgram.java (on the course website or pg.15 in book) – don’t copy/paste Compile the program and run it. Modify FirstProgram.java to input 3 integers and add them together – compile and run it