CSE 1020: Introduction to Computer Science I

Slides:



Advertisements
Similar presentations
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Advertisements

Types, Variables and Operators Computer Engineering Department Java Course Asst. Prof. Dr. Ahmet Sayar Kocaeli University - Fall 2013.
Shlomo Hershkop1 Introduction to java Class 1 Fall 2003 Shlomo Hershkop.
1 9/24/07CS150 Introduction to Computer Science 1 Relational Operators and the If Statement.
Introduction to Computers and Programming Lecture 4: Mathematical Operators New York University.
1 CS150 Introduction to Computer Science 1 Relational Operators and the If Statement 9/22/08.
Primitive Types CSE 115 Spring 2006 April 3 &
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
Hello, world! Dissect HelloWorld.java Compile it Run it.
Introduction to Programming (in C++) Data types and visibility Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. Computer Science, UPC.
01- Intro-Java-part1 1 Introduction to Java, and DrJava Barb Ericson Georgia Institute of Technology June 2008.
Georgia Institute of Technology Introduction to Java, and DrJava Barb Ericson Georgia Institute of Technology Aug 2005.
BUILDING JAVA PROGRAMS CHAPTER 2 PRIMITIVE DATA TYPES AND OPERATIONS.
Building Java Programs Primitive Data and Definite Loops.
1 Java Basics: Data Types, Variables, and Loops “ If debugging is the process of removing software bugs, then programming must be the process of putting.
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
1 CS 007: Introduction to Computer Programming Ihsan Ayyub Qazi.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Copyright 2010 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
1 More data types Character and String –Non-numeric variables –Examples: char orange; String something; –orange and something are variable names –Note.
1 Chapter 2: Java Fundamentals cont’d Spring Lory Al Moakar.
1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
CSE 1030: Implementing Static Features Mark Shtern.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Georgia Institute of Technology Introduction to Java, and DrJava part 1 Dr Usman Saeed Assistant Professor Faculty of Computing and Information Technology.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Review by Mr. Maasz, Summary of Chapter 2: Starting Out with Java.
CSE 1020:Using API Mark Shtern 1-1. Summary Delegation – Static Method, Object Client view vs Implementer view API, UML Errors Software Engineering Utility.
Copyright 2010 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Building Java Programs
Lecture 2: Operations and Data Types
Primitive Data, Variables, Loops (Maybe)
Introduction to Programming in Java
Building Java Programs Chapter 2
An Introduction to Java – Part I, language basics
Introduction to Java, and DrJava part 1
Building Java Programs
CSE 1020:Programming by Delegation
Building Java Programs
Chapter 2: Java Fundamentals
Topic 4 Expressions and variables
Building Java Programs
Building Java Programs Chapter 2
Introduction to Java, and DrJava
Building Java Programs
Building Java Programs
Chapter 2 Programming Basics.
Building Java Programs
Building Java Programs
Understand the interaction between computer hardware and software
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
Unit 3: Variables in Java
Building Java Programs Chapter 2
Building Java Programs
Introduction to Java, and DrJava
Introduction to Java, and DrJava part 1
Chapter 2 Primitive Data Types and Operations
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
Presentation transcript:

CSE 1020: Introduction to Computer Science I Mark Shtern

Course Objective Developing development skills Writing Java Multiclass application Introducing the software engineering concern Study UML, OOP, API

Example 01 Write application that calculates rectangle area

Example 02 Write application that calculates volume of rectangle couboid

Math & Computers Algebraic laws (a*b) /c is equal to a * (b/c)

Ex 1.16 What is program output? char grade= ‘B’; System.out.print(grade); { grade = ‘C’; } System.out.println(grade);

Ex 1.17 Explain the compile-time error long speed = 1; int size = 7; { boolean even = false; long speed = 5; size = 2; } int even = 3; System.out.println(speed); System.out.println(size); System.out.println(even);

Ex 1.17 What is output? long speed = 1; int size = 7; { boolean even = false; size = 2; } int even = 3; System.out.println(speed); System.out.println(size); System.out.println(even);

Summary Types Declaration Arithmetic Operations Casting Scope +,-,/,* ,% (remainder) Casting Scope

Shortcuts a++  a=a+1 a--  a=a-1 a+=6  a=a+6 a*=6 a=a*6

Literal Real Boolean Character 7D or 7d  7 is double 2.5E 3  2.5*10^3 or 2500.0 Boolean true or false Character ‘\t’ , ‘\n’, \’, ‘\\’,’\”’

Program Execution Edit Compile Run

Java Program Byte code Compile-time Errors VM CPU Byte code javac java instruction

Ex 1.18 Is it true that expression a * b * c/d (1) is evaluated as

Ex 1.21 Explain the compile-time error int i = 6; long l = 4; double d = 12; l = i + i; d = i + i; i = l + l; l = d + d;

Ex 1.22 Explain the compile-time error or predict its output int x = 3; int y = 14; double pie = x + y / 100.0; int z = (5 % 4) + 6 / 8; System.out.println (pie); System.out.println(z);

Math & Computer sqrt(x^2) vs (sqrt(x))^2 (1/x) * x vs x * 1/x

Char Type What is output? char letter = ‘D’; letter = (char) (letter +1); System.out.println(letter); ------------------------------------------ char letter2 = ‘A’; System.out.println(letter2 - letter);