CSC141 Computer Science I Zhen Jiang Dept. of Computer Science

Slides:



Advertisements
Similar presentations
Self Check 1.Which are the most commonly used number types in Java? 2.Suppose x is a double. When does the cast (long) x yield a different result from.
Advertisements

Computer Science 2 Data Structures V section 2 Recitation 1.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Introduction to C++ Programming. A Simple Program: Print a Line of Text // My First C++ Program #include int main( ) { cout
Expressions ► An expression can be a single variable, or can include a series of variables. If an expression includes multiple variables they are combined.
Chapter 3 Assignment and Interactive Input. 2 Objectives You should be able to describe: Assignment Operators Mathematical Library Functions Interactive.
CS150 Introduction to Computer Science 1
Summer Training on Computer Science, WCU Summer Training on Computer Science Zhen Jiang Department of Computer Science West Chester University.
Basic Elements of C++ Chapter 2.
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC141 Computer Science I.
CSC115: Matlab Special Session Dr. Zhen Jiang Computer Science Department West Chester University.
Chapter 2 Basic Elements of Java. Chapter Objectives Become familiar with the basic components of a Java program, including methods, special symbols,
CSC141 Computer Science I Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA 19383
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 4 Mathematical Functions, Characters,
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC141 Computer Science I 5/27/20161.
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.
Control Structures (A) Topics to cover here: Introduction to Control Structures in the algorithmic language Sequencing.
Introduction to Computer Programming CS 126 Lecture 4 Zeke Maier.
CSC115 Introduction to Computer Programming Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA 19383
CSC115 Introduction to Computer Programming Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA 19383
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC141 Computer Science I 12/11/20151.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
CSCE 102 – Chapter 11 (Performing Calculations) CSCE General Applications Programming Benito Mendoza Benito Mendoza 1 By Benito Mendoza.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
Building java programs, chapter 3 Parameters, Methods and Objects.
CSC115: Matlab Special Session Dr. Zhen Jiang Computer Science Department West Chester University.
Chapter 3 Numerical Data. Objectives After you have read and studied this chapter, you should be able to Select proper types for numerical data. Write.
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC141 Computer Science I 2/4/20161.
Literals A literal (sometimes called a constant) is a symbol which evaluates to itself, i.e., it is what it appears to be. Examples: 5 int literal
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC141 Computer Science I.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
Lesson 4: Introduction to Control Statements 4.1 Additional Operators Extended Assignment Operators –The assignment operator can be combined with the.
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC530 Data Structures - LOOP 7/9/20161.
Chapter Topics The Basics of a C++ Program Data Types
Chapter 6 JavaScript: Introduction to Scripting
What Actions Do We Have Part 1
Unit 2 Elementary Programming
Chapter 3 Assignment and Interactive Input.
Introduction to Computer Science / Procedural – 67130
for Repetition Structures
Basic Elements of C++.
Chapter 2 Assignment and Interactive Input
Java Programming: From Problem Analysis to Program Design, 4e
CSC115 Introduction to Computer Programming
CSC115 Introduction to Computer Programming
Basic Elements of C++ Chapter 2.
CSC240 Computer Science III
CSC 142 Computer Science II
CSC141 Computer Science I Zhen Jiang Dept. of Computer Science
Loop Development Zhen Jiang Dept. of Computer Science
Chapter 2 Elementary Programming
CSC115 Introduction to Computer Programming
CSS 161 Fundamentals of Computing Introduction to Computers & Java
CSC115 Introduction to Computer Programming
WEB PROGRAMMING JavaScript.
CSC141 Computer Science I Zhen Jiang Dept. of Computer Science
Chapter 2: Basic Elements of Java
CSC530 Data Structure - Decision
Zhen Jiang West Chester University
IFS410 Advanced Analysis and Design
CSC115 Introduction to Computer Programming
Seating “chart” Front Back 4 rows 5 rows 5 rows 4 rows 2 rows 2 rows
See requirements for practice program on next slide.
Instance Method – CSC142 Computer Science II
Zhen Jiang West Chester University
JavaScript: Introduction to Scripting
Chapter 2: Java Fundamentals cont’d
CS 1111 Introduction to Programming Spring 2019
Presentation transcript:

CSC141 Computer Science I Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA 19383 zjiang@wcupa.edu

Table of Contents Introduction Plain text format printout Variable and its value type Operator Math.pow & Math.sqrt Combined assignment DecimalFormat Prefix/postfix increment

Welcome Code 2-1, page 27 Names Main { } and ( ) Println and print (Code 2-3, page 35) \n (Code 2-5, page 36), \t (Code 2-6, page 37), and table 2-2. // (not \\) , page 77

Variable Code 2-7, page 39 Type (declaration) Name, page 43 Begin with [a]-[Z], or _, or $ Contain only [a]-[Z], [0]-[9], _, and $ No keyword Case distinct Samples, table 2-4, page 43

Assignment Assignment Left is a single variable Right is a legal expression Initialization, page 52 Value of variable and execution time line, page 53

Expression Operator, Code 2-8, page 40, Table 2-7, page 55 Precedence order, table 2-8, page 58 Prefix/postfix increment (decrement), page 193-196 n[x][y][pd].counter[type]++ Casting, page 66 17/3=? 17.0/3=? (double)17/3 = ? Types, Code 2-10, page 46 Sample, Code 2-18, page 60 10% off?

Advanced techniques Math.pow and Math.sqrt, page 62 Math.PI, page 70 Combined assignment, table 2-13, page 63 Scope, page 75

Keyboard Input Code 2-29, page 87

String Displaying message, Code 2-32, page 94 Input, converting a string to number, Code 2-33, page 97 Value of, page 582-583 Parse, table 2-18, page 96 Output converting a number to string, toString, page 603 DecimalFormat, Code 3-21,22,23,24, page 174-180

String (continue…) indexof, page 574 Substring, table 9-5, page 577 Concat, Table 9-6, page 581 Replace, Table 9-6, page 581 Length, Code 2-21, page 73 Sting.valueOf, table 9-7, page 583

Example String split “12.123456” => “12.123”