Chapter 1 Chapter 2 Chapter 3 Code Gone Wrong Random 5 pt 5 pt 5 pt

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
Constants and Data Types Constants Data Types Reading for this class: L&L,
1 Fall 2008ACS-1903 Chapter 1 Topics Java History Java Programs Why Program? Computer Systems: Hardware and Software Programming Languages What Is a Program.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Chapter3: Language Translation issues
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
Chapter 2 - Java Programming Fundamentals1 Chapter 2 Java Programming Fundamentals.
1 Chapter 2: Elementary Programming Shahriar Hossain.
String Escape Sequences
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
1 Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class:
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
CSCI 1100/1202 January 16, Why do we need variables? To store intermediate results in a long computation. To store a value that is used more than.
CIS Computer Programming Logic
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Chapter 2: Basic Elements of Java J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
INTRODUCTION TO JAVA CHAPTER 1 1. WHAT IS JAVA ? Java is a programming language and computing platform first released by Sun Microsystems in The.
Chapter 2 Basic Elements of Java. Chapter Objectives Become familiar with the basic components of a Java program, including methods, special symbols,
1 Do you have a CS account? Primitive types –“ building blocks ” for more complicated types Java is strongly typed –All variables in a Java program must.
Introduction to Computer Systems and the Java Programming Language.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Outline Character Strings Variables and Assignment Primitive Data Types Expressions Data Conversion Interactive Programs Graphics Applets Drawing Shapes.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
EG280 Computer Science for Engineers Fundamental Concepts Chapter 1.
CIS 260: App Dev I. 2 Programs and Programming n Program  A sequence of steps designed to accomplish a task n Program design  A detailed _____ for implementing.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
Java Programming: From Problem Analysis to Program Design, 5e Chapter 2 Basic Elements of Java.
Characters. Character Data char data type – Represents one character – char literals indicated with ' '
Assignment An assignment statement changes the value of a variable The assignment operator is the = sign total = 55; Copyright © 2012 Pearson Education,
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
The character data type char. Character type char is used to represent alpha-numerical information (characters) inside the computer uses 2 bytes of memory.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
Chapter 2 Input, Variables and Data Types. JAVA Input JAVA input is not straightforward and is different depending on the JAVA environment that you are.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
ITK 168 – More Variables 10/13/05. Another example of using instance variables and constants  Go through SimpleBot  Modify SimpleBot to “teleport”
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
CHAPTER 1 COMPUTER SCIENCE II. HISTORY OF COMPUTERS (1.1) Eniac- one of the worlds first computers Used more electricity than an entire city block of.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Chapter 1: Introduction to Computers and Programming.
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.
Unit 1 Review By: Mr. Jacobs.
Basic Data Types อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 4.
CSII Final Review. How many bits are in a byte? 8.
Java Fundamentals MIS 3023 Business Programming Concepts II The University of Tulsa Professor: Akhilesh Bajaj All slides in this presentation ©Akhilesh.
© 2004 Pearson Addison-Wesley. All rights reserved August 27, 2007 Primitive Data Types ComS 207: Programming I (in Java) Iowa State University, FALL 2007.
Chapter 1: Introduction to Computers and Programming
Computer Science II Chapter 1.
Engineering Problem Solving With C An Object Based Approach
Computer programming {weeks 01 and 02}
Documentation Need to have documentation in all programs
Primitive Data Types August 28, 2006 ComS 207: Programming I (in Java)
C++ Programming: From Problem Analysis to Program Design
Type Conversion, Constants, and the String Object
Java Programming: From Problem Analysis to Program Design, 4e
Chapter 1: Introduction to Computers and Programming
Building Java Programs Chapter 2
Review for Exam 1 Spring 2007 CS 101/CS 101-E.
Sridhar Narayan Java Basics Sridhar Narayan
High Level Programming Languages
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
Java Programming Language
Review of Java Fundamentals
Presentation transcript:

Chapter 1 Chapter 2 Chapter 3 Code Gone Wrong Random 5 pt 5 pt 5 pt Eleanor M. Savko Chapter 1 Chapter 2 Chapter 3 4/11/2017 Code Gone Wrong Random 5 pt 5 pt 5 pt 5 pt 5 pt 10 pt 10 pt 10 pt 10 pt 10 pt 15 pt 15 pt 15 pt 15 pt 15 pt 20 pt 20 pt 20 pt 20 pt 20 pt 25 pt 25 pt 25 pt 25 pt 25 pt

What is the difference between Application and System Software What is the difference between Application and System Software? Give one example of each.

System: supports basic operations examples: operating system, compiler Application: accomplish specialized tasks examples: word processor, spreadsheet, etc

Convert to base 10: 0011 1001

57

What is the difference between ASCII and Unicode?

ASCII = 1 byte per character Unicode = 2 bytes per character

Which is oldest? (i) Assembly Language (ii) High-Level Language (iii) Machine Language

Machine Language

Name the stages of the Software Development Life Cycle (in order)

1) Customer Request 2) Analysis 3) Design 4) Implementation 5) Integration 6) Maintenance

What is the JVM, and what does it do?

Java Virtual Machine. It acts as an interpreter for the machine.

What is source code? What is byte code? What are their extensions?

Source Code: file written by programmer ( Source Code: file written by programmer (.java extension) Byte Code: created by compiler (.class extension)

Give an example of “storage” and an example of “memory”

Storage: hard drive, floppy, cd-rom, etc. Memory: RAM, ROM

Name three primitive data types.

int, double, boolean

Declare and instantiate an object of class KeyboardReader.

KeyboardReader reader = new KeyboardReader();

Declare three integer variables (a,b,c) in a single declaration and initialize b to 4.

int a, b=4, c;

What is wrong with this code. How can you fix it What is wrong with this code? How can you fix it? int inches; inches = reader.readInt(); double feet = inches/12;

int/int = int Fixed with casting

String x = “number “ + 3 + 4; String y = “number “ + 3 String x = “number “ + 3 + 4; String y = “number “ + 3 * 4; String z = “number “ + (3 + 4);

x = “number 34” y = “number 12” z = “number 7”

What is the value of s2? int x = 8, y=10; String s1 = “hey”; x = x + y; String s2; s2 = x + y + s1 + x + y;

28hey1810

double z = 9. 0; int x=4, y=13; double a, b, c; a = y / x double z = 9.0; int x=4, y=13; double a, b, c; a = y / x * z; b = (double) (y / x) * z; c = y % x / 3;

a = 27.0 b = 27.0 c = 0.0

Find the Syntax Error int x = 20, y = 15, z; double u=2. 1, v=33 Find the Syntax Error int x = 20, y = 15, z; double u=2.1, v=33.3; z = x/y; u = x; z = (int)(u/v); w = u + v; u = x/y*u*v;

w is not declared

Find the Syntax Error: int a=5, b=10, c=2; double d=2. 2, e=33 Find the Syntax Error: int a=5, b=10, c=2; double d=2.2, e=33.1; String s=“bob”; a = a/b; d = a/b; b = c/b + e; s = a + s + e;

b = c/b + e; double assigned to int

Find the Syntax Error: String one = “you”; String two = “smell”; String three = “funny”; String four; four = one + two + three; four = “four”+“four”+four; four = one + two + three + too!; four = two;

four = one + two + three + too!; String literal not in quotes!!!

Find the Syntax Error: int x =5, y=10, z; double a=1. 2, b=2, c=4 Find the Syntax Error: int x =5, y=10, z; double a=1.2, b=2, c=4.1; a = x/y; x = (int)c / b + y; a = (double)(x/y); c = c + y; z = (int)c / x;

x = (int)c / b + y; Assigning double into int variable!

Find the Syntax Error: int x =5, y=10, z; double a=1. 2, b=2, c=4 Find the Syntax Error: int x =5, y=10, z; double a=1.2, b=2, c=4.1; a = x/y; x = (int)(c / b) + y; a = (double)(x/y); c = c + z; z = (int)c / x;

c = c + z; z has not been initialized

double x =(double) (1/4) * 4; System.out.println(x);

0.0

Convert to Base 10 1000 1111

143

String blah = “I”; String blah2 = “Can”; String blah3 = “Program”; blah = blah + blah2; blah2 = blah; System.out.println(blah + “\n” + blah3 + “\n” + blah2 );

ICan Program ICan

Convert from hexadecimal to base 10: 59AF

22959

Which of the following expressions does NOT evaluate to 0. 4 Which of the following expressions does NOT evaluate to 0.4? (A)   (int)4.5 / (double)10; (B)   (double)(4/10); (C)   4.0 / 10.0; (D)   4 / 10.0; (E)    (double)4 / (double)10;

(B)   (double)(4/10);