Michele Weigle - COMP 14 - Spr 04

Slides:



Advertisements
Similar presentations
Important Notes Pay attention to file names!!! You must name them what we tell you to. mkdir – make a folder (make the ones we tell you to) rm – remove.
Advertisements

CSCI S-1 Section 5. Deadlines for Problem Set 3 Part A – Friday, July 10, 17:00 EST Parts B – Tuesday, July 14, 17:00 EST Getting the code examples from.
Loops – While Loop Repetition Statements While Reading for this Lecture, L&L, 5.5.
COMP 110 Loops Tabitha Peck M.S. February 11, 2008 MWF 3-3:50 pm Philips
COMP 110 More Loops and Strings Tabitha Peck M.S. February 18, 2008 MWF 3-3:50 pm Philips
Scanner Pepper With credits to Dr. Siegfried. The Scanner Class Most programs will need some form of input. At the beginning, all of our input will come.
COMP 110 Errors, Strings, and Review Tabitha Peck M.S. January 28, 2008 MWF 3-3:50 pm Philips
COMP 110 Branching Statements and Boolean Expressions Tabitha Peck M.S. January 28, 2008 MWF 3-3:50 pm Philips
Moving To Code 3 More on the Problem-Solving Process §The final step in the problem-solving process is to evaluate and modify (if necessary) the program.
Scanner & Stepwise Refinement Pepper With credit to Dr. Siegfried.
Writing algorithms using the for-statement. Programming example 1: find all divisors of a number We have seen a program using a while-statement to solve.
Computer Programming Lab(4).
1 BUILDING JAVA PROGRAMS CHAPTER 3 THE SCANNER CLASS AND USER INPUT.
Announcements Quiz 2 Grades Posted on blackboard.
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
CS1101: Programming Methodology Aaron Tan.
Introduction to Information and Computer Science Computer Programming Lecture c This material (Comp4_Unit5c), was developed by Oregon Health and Science.
COMP 110 Computer Basics Luv Kohli August 25, 2008 MWF 2-2:50 pm Sitterson
COMP 110 Spring Announcements Computers in class on Friday: Lab Office Hours: Monday 12-2 New students see me after class Administrative Changes.
COMP 110: Introduction to Programming Tyler Johnson January 14, 2009 MWF 11:00AM-12:15PM Sitterson 014.
Catie Welsh January 12, 2011 MWF 1-1:50 pm Sitterson
1 Introduction to Java Brief history of Java Sample Java Program Compiling & Executing Reading: => Section 1.1.
Object Oriented Programming Computer Engineering Department JAVA Programming Course Asst. Prof. Dr. Ahmet Sayar Kocaeli University - Fall 2014.
Lecture 2: Classes and Objects, using Scanner and String.
Catie Welsh January 10, 2011 MWF 1-1:50 pm Sitterson 014.
1 Fencepost loops “How do you build a fence?”. 2 The fencepost problem Problem: Write a class named PrintNumbers that reads in an integer called max and.
COMP String and Console I/O Yi Hong May 18, 2015.
CSI 1390: Introduction to Computers TA: Tapu Kumar Ghose Office: STE 5014 Office hours: Thursday 1300 – 1400hrs.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 4.
1 while loops. 2 Definite loops definite loop: A loop that executes a known number of times.  The for loops we have seen so far are definite loops. We.
COMP 110 switch statements and while loops Luv Kohli September 10, 2008 MWF 2-2:50 pm Sitterson
COMP Flow of Control: Branching 1 Yi Hong May 19, 2015.
CSC1401 Strings (text). Learning Goals Working with Strings as a data type (a class) Input and output of Strings String operations.
Introduction Chapter 1 8/31 & 9/1 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC141 Computer Science I 12/11/20151.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 3.
Catie Welsh February 2,  Program 1 Due Today by 11:59pm today  Program 2 Assigned Today  Lab 2 Due Friday by 1:00pm 2.
Cumulative algorithms. 2 Adding many numbers How would you find the sum of all integers from ? // This may require a lot of typing int sum = 1 +
Introduction to array: why use arrays ?. Motivational example Problem: Write a program that reads in and stores away 5 double numbers After reading in.
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC141 Computer Science I 2/4/20161.
COMP 110 Branching Statements and Boolean Expressions Luv Kohli September 8, 2008 MWF 2-2:50 pm Sitterson
1 Project 3 String Methods. Project 3: String Methods Write a program to do the following string manipulations: Prompt the user to enter a phrase and.
import java.util.Scanner; class myCode { public static void main(String[] args) { Scanner input= new Scanner(System.in); int num1; System.out.println(“Enter.
1 Simple Input Interactive Input - The Class Scanner n Command-Line Arguments.
A.P. Computer Science Input is NOT tested on the AP exam, but if we want to do any labs, we need input!!
Introduction to programming in java
1 Project 12: Cars from File. This is an extension of Project 11, Car Class You may use the posted solution for Project 11 as a starting point for this.
COMP Review of Chapter 1 & 2
Chapter 2 Clarifications
Exercise 1- I/O Write a Java program to input a value for mile and convert it to kilogram. 1 mile = 1.6 kg. import java.util.Scanner; public class MileToKg.
Michele Weigle - COMP 14 - Spr 04 Catie Welsh March 30, 2011
Chapter 5: Control Structures II
Repetition-Counter control Loop
TK1114 Computer Programming
Something about Java Introduction to Problem Solving and Programming 1.
BIT115: Introduction to Programming
Java Fix a program that has if Online time for Monday’s Program
COMP 110 Loops, loops, loops, loops, loops, loops…
Java Fix a program that has if Online time for Monday’s Program
Announcements Lab 7 due Wednesday Assignment 4 due Friday.
class PrintOnetoTen { public static void main(String args[]) {
Announcements Lab 6 was due today Lab 7 assigned this Friday
Introduction to Java Brief history of Java Sample Java Program
Lecture 1a- Introduction
CIS 110: Introduction to Computer Programming
CS 250, Discrete Structures, Fall 2014 Nitesh Saxena
Michele Weigle - COMP 14 - Spr 04 Catie Welsh February 14, 2011
Random Numbers while loop
AME Spring Lecture 11 - Thrust and aircraft range
Presentation transcript:

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