Darrell Bethea May 10, MTWRF 9:45-11:15 AM Sitterson 011

Similar documents
COMP Computer Basics. Yi Hong May 13, 2015

St. Edmund Preparatory High School Brooklyn, NY

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Darrell Bethea May 25, 2011

Introduction to Computers and Java

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Introduction to Computers and Java

Input. Scanner keyboard = new Scanner(System.in); String name;

CSE 1223: Introduction to Computer Programming in Java Chapter 1 Computer Basics

Chapter 1. Introduction to Computers and Programming. M hiwa ahmad aziz

Introduction to Computers and Java

What did we talk about last time? Examples switch statements

CS 152: Data Structures with Java Hello World with the IntelliJ IDE

CS 101 Spring 2007 Midterm 2 Name: ID:

Lab Determining Data Storage Capacity

Introduction. Arizona State University 1

Loops. CSE 114, Computer Science 1 Stony Brook University

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

Introduction to Computers and Java

Over and Over Again GEEN163

COMP 110 Project 1 Programming Project Warm-Up Exercise

Chapter 1: Why Program? Computers and Programming. Why Program?

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing

Chapter 1: Introduction to Computers and Programming

Anatomy of a Java Program: Comments

Chapter 5 Lab Methods

CSC116: Introduction to Computing - Java

4. If the following Java statements are executed, what will be displayed?

Introduction to Computers and Java

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015

Gaddis: Starting Out with Java: From Control Structures through Objects, 6/e

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016

CSC116: Introduction to Computing - Java

Class List. Java Must Have. Class Goals. Class Goals. Schedule

AP Computer Science Unit 1. Programs

Tutorial 1 CSC 201. Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal

Please answer the following questions. Do not re-code the enclosed codes if you have already completed them.

Starting Out with Java: From Control Structures through Data Structures 3e (Gaddis and Muganda) Chapter 2 Java Fundamentals

AP Computer Science Unit 1. Writing Programs Using BlueJ

Introduction to Java Unit 1. Using BlueJ to Write Programs

What two elements are usually present for calculating a total of a series of numbers?

Example Program. public class ComputeArea {

System Unit Components Chapter2

COMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015

Lec 3. Compilers, Debugging, Hello World, and Variables

CSc 2010 Principles of Computer Science, Fall 2013 Practice Problems for Midterm 3* * 3 17 % 9-20 % (26 / 7) "2"

ITERATION WEEK 4: EXMAPLES IN CLASS

AP Computer Science Unit 1. Writing Programs Using BlueJ

CompSci 125 Lecture 02

Introduction to Java & Fundamental Data Types

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Software and Programming 1

Full file at

CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1. Name SOLUTION

9/11/08 (c) 2008 Matthew J. Rutherford Class (c) 2008 Matthew J. Rutherford Class

Chapter 5 Lab Methods

COMP-202 Unit 1: Introduction. CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics

CHAPTER 5 VARIABLES AND OTHER BASIC ELEMENTS IN JAVA PROGRAMS

Chapter 2: Data and Expressions

Tutorials. Tutorial every Friday at 11:30 AM in Toldo 204 * discuss the next lab assignment

CHAPTER 1 Introduction to Computers and Java

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

Data Structures Lecture 1

10/3/2018 Programming Data Structures. Casting: upcasting, downcasting Debugging again! Yay! Exception Handling

Java Assignment 3: Loop Practice Ver 3.0 Last Updated: 12/1/2015 8:57 AM

CS 177 Recitation. Week 1 Intro to Java

Midterm Examination (MTA)

Introduction to Computers and Java

1. What is the difference between a compiler and an interpreter? Also, discuss Java s method.

13 th Windsor Regional Secondary School Computer Programming Competition

Arrays and Lists CSC 121 Fall 2014 Howard Rosenthal

Constants. Why Use Constants? main Method Arguments. CS256 Computer Science I Kevin Sahr, PhD. Lecture 25: Miscellaneous

CSC116: Introduction to Computing - Java

CS 101 Fall 2005 Midterm 2 Name: ID:

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal

! definite loop: A loop that executes a known number of times. " The for loops we have seen so far are definite loops. ! We often use language like

Entry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process

Chapter 6 Lab Classes and Objects

Lesson 10: Quiz #1 and Getting User Input (W03D2)

INTRODUCTION TO COMPUTERS

Computer Training for Newcomers

Electricity: Voltage. Gate: A signal enters the gate at a certain voltage. The gate performs operations on it, and sends it out was a new signal.

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

COMP 202 Java in one week

Loops. Eng. Mohammed Abdualal. Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department

Lab Activity Plan. John Dalbey CPE /30/2013

CSCI 1103: Introduction

Chapter Two. Hardware Basics: Inside the Box

Welcome to Solving Problems with Computers I

Course Outline. Introduction to java

C Sc 227 Project 1: Three Main Methods

Java Classes: Math, Integer A C S L E C T U R E 8

BASICS.

CIS260 Summer Exam 1 First Name Last Name: 2) is the brain of a computer. 2) A) Memory B) Hardware C) Disk D) CPU

Getting started with Java

Fundamentals of Programming Data Types & Methods

Chapter 4: Conditionals and Recursion

CS 101 Fall 2006 Midterm 1 Name: ID:

Transcription:

Darrell Bethea May 10, 2011 MTWRF 9:45-11:15 AM Sitterson 011 1

Office hours: MW 1-2 PM If you still cannot make it to either office hour, email me to set up an appointment if you need help with an assignment.

Hardware and Memory Programs and Compiling Your first program

Need to know basics of a computer If you want to cook, you should know basic ingredients and understand how food is prepared. Understand what your program is doing Talk intelligently about computers 5

Hardware - physical machine CPU, Memory Software - programs that give instructions to the computer Windows XP, Google Chrome, Games, Eclipse 6

CPU (Central Processing Unit) - the Brain GHz Number of billions of instructions per second I.e, how fast the computer is Dual Core - multiple processing units per CPU 7

Holds data for the computer How much the Brain can remember Main Memory Memory computer uses for intermediate calculations (program you are running) Disappears when you shut down your computer Secondary Memory Disk drives, CDs, Flash drives Exists until you delete it 8

Your main memory 2 gigabytes of RAM (Meter - unit of distance) Bytes - unit of data Kilobyte = 1 thousand bytes Megabyte = 1 million bytes Gigabyte = 1 billion bytes 9

Smallest addressable unit of memory Both main memory and auxiliary memory are measured in bits 1 byte = 8 bits Bit = 0 or 1 (on or off) Language of the computer is bits 0 0 1 1 1 0 1 0-1 byte of 8 bits 10

Set of instructions for a CPU to follow Also known as software. You will be writing programs We will look at one soon Hard for humans to write bits directly 11

Your Program High-level language (human readable) Compiler Machine Language (Bits) Low-level language (computer readable) 12

What are the two kinds of memory in a computer? What is software? What is the difference between a machinelanguage program and a high-level language program? 13

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 numbers 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); 14

import java.util.*; Package = Library of classes Java.util is a package Different libraries give different information Physics Library = Newtonian Physics Music Library = your itunes collection java.util. = Allows you to read data from keyboard 15

Begin the Program public class FirstProgram { public static void main(string[] args) { Begin a program named FirstProgram Program names should make sense Another name for this program could be AddTwoNumbers You should always capitalize the first letter of each word in your program name 16

System.out.println("Hello out there."); System.out.println("I will add two numbers for you."); System.out.println("Enter two whole numbers on a line:"); Write what is in quotes to screen 17

Class - Category of Objects E.g., Stapler Object - A specific member of that category E.g., My red Swingline Method - Actions performed by objects E.g., Staple pages, load staples, fix jam, etc. 18

myredswingline.fixjam(); Object ramses.eatgrass(); System.out.println( Hi ); Method Invoke Method 19

int n1, n2; Variable - store piece of data n1 - store integer n2 - store integer 20

Scanner keyboard = new Scanner(System.in); Class Object Not always System.in Create object (keyboard) of Scanner class Stapler myredswingline = new Stapler(); 21

Object n1 = keyboard.nextint(); Invoke/Call Method Read an integer from the keyboard and store it in n1 22

System.out.println("The sum of those two numbers is"): System.out.println(n1 + n2); Add n1 and n2 Print the sum to the screen 23

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 numbers 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); 24

Hello out there. I will add two numbers for you. Enter two whole numbers on a line: 12 30 Input by user The sum of those two numbers is 42

Before Tomorrow Eclipse Your first java program Download and Install Eclipse before lab (see webpage) Go through the Eclipse Tutorial on your own Get the textbook! Read 1.1-1.3