COMP 110 Computer Basics Luv Kohli August 25, 2008 MWF 2-2:50 pm Sitterson 014 1.

Slides:



Advertisements
Similar presentations
Calera High School Dawn Bone
Advertisements

Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib.
Computer Hardware.
Introduction to Computers and Java Module 1. Objectives overview computer hardware and software introduce program design and object-oriented programming.
Introduction to Computers and Java Objects
Wednesday, 9/4/02, Slide #1 1 CS 106 Intro to CS 1 Wednesday, 9/4/02  Today: Introduction, course information, and basic ideas of computers and programming.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 24, 2005.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Introduction to Computers
COMP 110 Designing Programs Tabitha Peck M.S. January 16, 2008 MWF 3-3:50 pm Philips
COMP 110 Errors, Strings, and Review Tabitha Peck M.S. January 28, 2008 MWF 3-3:50 pm Philips
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
Introduction Algorithms and Programming. Computer Programming  A form of problem solving  Or, more accurately, a way to solve problems  What we will.
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
1 The First Step Learning objectives write Java programs that display text on the screen. distinguish between the eight built-in scalar types of Java;
CS 0008 Day 2 1. Today Hardware and Software How computers store data How a program works Operators, types, input Print function Running the debugger.
COMP Computer Basics Yi Hong May 13, 2015.
CSE 131 Computer Science 1 Module 1: (basics of Java)
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
How Computers Work. A computer is a machine f or the storage and processing of information. Computers consist of hardware (what you can touch) and software.
Ch 1. Introduction Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2012.
Chapter 1Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 1 l Background information »important regardless of programming.
©Silberschatz, Korth and Sudarshan1.1 Chapter 1: Introduction to Computers and Java Objects Background information  hardware  software  computer languages.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
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
Chapter 1: Introduction to Computers and Programming.
Introduction to Computers
Introduction to Computers
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
Week 1 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
1 Introduction to Java Brief history of Java Sample Java Program Compiling & Executing Reading: => Section 1.1.
Computer Parts. Two Basic Parts Hardware & Software.
Object Oriented Programming Computer Engineering Department JAVA Programming Course Asst. Prof. Dr. Ahmet Sayar Kocaeli University - Fall 2014.
Introduction to Computer Systems and the Java Programming Language.
What is computer hardware? Computer hardware are the physical components of the computer.
Introduction to Computers and Java Module 1. Objectives overview computer hardware and software introduce program design and object-oriented programming.
Using Data Within a Program Chapter 2.  Classes  Methods  Statements  Modifiers  Identifiers.
Lecture 8 February 29, Topics Questions about Exercise 4, due Thursday? Object Based Programming (Chapter 8) –Basic Principles –Methods –Fields.
What does a computer do? Accepts data through inputting Processes data
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
1 st Semester Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND.
Introduction Chapter 1 8/31 & 9/1 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
© 2006 Pearson Education Chapter 1: Computer Systems.
Chapter 1- Basic Computing and your first program.
COMP 110 Worksheet review, debugger Luv Kohli September 29, 2008 MWF 2-2:50 pm Sitterson 014.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 3.
The Computer System CS 103: Computers and Application Software.
Chapter 1 Getting Acquainted With Computers, Programs, and C++
Computer Systems. Bits Computers represent information as patterns of bits A bit (binary digit) is either 0 or 1 –binary  “two states” true and false,
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Ch 1 - Introduction to Computers and Programming Hardware Terminology Main Memory Auxiliary Memory Drives Writing Algorithms Using Pseudocode Programming.
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
CS 125 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk drive Software.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Introduction to Programming. Key terms  CPU  I/O Devices  Main memory  Secondary memory  Operating system  User interface  Application  GUI 
COMP Review of Chapter 1 & 2
Introduction to Computers and Programming
Chapter 1: An Overview of Computers and Programming Languages
Introduction to Computers
Something about Java Introduction to Problem Solving and Programming 1.
Michele Weigle - COMP 14 - Spr 04
Introduction to Computers
Introduction to Java Brief history of Java Sample Java Program
Presentation transcript:

COMP 110 Computer Basics Luv Kohli August 25, 2008 MWF 2-2:50 pm Sitterson 014 1

Announcements jGRASP Office Hours ◦ Link to survey on web site Honor Code document 2

Questions? 3

Today in COMP Hardware and Memory Programs and Compiling Your first program

Before Programming Need to know basics of a computer ◦ If you drive a car you should know it runs on gasoline What’s in the box? 5

Hardware vs. Software Hardware - physical machine ◦ CPU, Memory Software - programs that give instructions to the computer ◦ Windows XP, Games, jGRASP 6

Hardware An aside: there is a computer museum in the first floor lobby of Sitterson Hall

Hardware CPU (Central Processing Unit) - the “Brain” ◦ Executes your instructions ◦ GHz - number of instructions per second, how fast is the computer ◦ Dual Core - multiple processing units per CPU, multiple brains 8

Memory Holds data for the computer How much the “Brain” can remember Main Memory ◦ Memory computer uses for intermediate calculations (program you are running) ◦ Expensive Auxiliary Memory (Secondary Memory) ◦ Disk drives, CDs, Flash drives ◦ Cheap 9

RAM (random access memory) Your main memory Random access? ◦ Fast access ◦ Access any location in memory in constant time 10

Measuring memory 2 gigabytes (GB) of RAM ◦ Bytes - measurement of memory ◦ Megabyte (MB) = 1 million (10 6 ) bytes (or 1,048,576 = 2 20 bytes) ◦ Gigabyte (GB) = 1 billion (10 9 ) bytes (or 1,073,741,824 = 2 30 bytes) 11

What is a byte? 1 byte = 8 bits (thanks to Dr. Brooks) Bit = 0 or 1 (off or on) Language of the computer is bits byte of 8 bits Characters, numbers, encoded as series of bits – a byte: ◦ 0: ◦ A: ◦ a:

Program Set of instructions for a CPU to follow You will be writing programs ◦ We will look at one soon 13 public class Hello { public static void main(String[] args) { System.out.println("Hello world!"); }

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

Java Object-oriented programming (OOP) language Based on the world around us 15

Objects, Methods, and Classes (oh my!) Object – program construction that has data and methods Methods – actions performed by objects Class – a type of object (e.g. Vehicle, Television) – objects in same class have same kinds of data and methods 16 Class: CarObject: myCar DataMakeHonda ModelCivic MethodsAccelerate()Accelerate Brake()Decelerate

Java: three main design principles Encapsulation Polymorphism Inheritance 17

Encapsulation Information hiding Packaging things up, only part of what is going on is visible ◦ myCar.accelerate() ◦ yourCar.accelerate() Just call these methods, the car will execute them 18

Polymorphism “Many forms” One method call can cause different actions in different contexts ◦ Class Airplane  Object: myAirplane.accelerateToMaxSpeed()  550mph ◦ Class Car  Object: myCar.accelerateToMaxSpeed()  100mph 19

Inheritance Way of organizing classes At each level, classification becomes more specific 20 Vehicle Automobile Bus Family carSports car School Bus Luxury Bus

Sample Java Program (section 1.3) 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 numbers 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); } } 21

java.util Package import java.util.*; Package = library of classes (standard programs) Different libraries have different classes and functions ◦ Physics library = Newtonian Physics ◦ java.util.* = Java utility classes, used for many things including reading data from keyboard 22

Begin the program public class FirstProgram { public static void main(String[] args) { Begin a program named FirstProgram Program names should make sense A program is also a class in Java ◦ A program class has a unique method ‘main’ 23

Output to screen 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 24

Invoke methods on objects myCar.start(); airplane.land(); System.out.println(“Hi”); Object Method Invoke Method 25 Arguments

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

Create Scanner Object Scanner keyboard = new Scanner(System.in); Create object or instance (keyboard) of Scanner class Car myCar = new Car(); ClassObject Not always System.in 27

Call method on object n1 = keyboard.nextInt(); Read an integer from the keyboard and store it in n1 Object Method Invoke/Call 28

Output to screen 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 29

Sample Java Program (section 1.3) 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 numbers 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); } } 30

Wednesday Designing Programs (Read 1.2) If time, start primitive types (start reading 2.1) Come to office hours if jGRASP is not working 31