CSC141 Computer Science I Zhen Jiang Dept. of Computer Science

Slides:



Advertisements
Similar presentations
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 9 Strings.
Advertisements

Types, Variables and Operators Computer Engineering Department Java Course Asst. Prof. Dr. Ahmet Sayar Kocaeli University - Fall 2013.
Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
Expressions ► An expression can be a single variable, or can include a series of variables. If an expression includes multiple variables they are combined.
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
Shlomo Hershkop1 Introduction to java Class 1 Fall 2003 Shlomo Hershkop.
Introduction to Computers and Programming Lecture 7:
CMT Programming Software Applications
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
CSci 142 Data and Expressions. 2  Topics  Strings  Primitive data types  Using variables and constants  Expressions and operator precedence  Data.
Copyright 2013 by Pearson Education Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
Basic Elements of C++ Chapter 2.
1 Chapter 2 JAVA FUNDAMENTALS CONT’D. 2 PRIMITIVE DATA TYPES Computer programs operate on data values. Values in Java are classified according to their.
1 Building Java Programs Chapter 1: Introduction to Java Programming These lecture notes are copyright (C) Marty Stepp and Stuart Reges, They may.
Copyright 2008 by Pearson Education Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading: self-check: #1-14.
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC141 Computer Science I.
Java Building Elements Lecture 2 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University
Dr. Zhen Jiang Computer Science Department West Chester University
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
CSC 545: Database Systems 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,
CSC321: Database Management Systems Dr. Zhen Jiang Computer Science Department West Chester University West Chester, PA
CSC141 Computer Science I Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA 19383
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
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.
CSC 142 Computer Science II Zhen Jiang West Chester University
CSC115 Introduction to Computer Programming Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA 19383
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
1 1 Chapter 2 Elementary Programming. 2 2 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from.
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC141 Computer Science I.
CS0007: Introduction to Computer Programming Primitive Data Types and Arithmetic Operations.
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Chapter 2 Variables.
Chapter Topics The Basics of a C++ Program Data Types
CSC321: Database Management Systems
Introduction to the C Language
String class.
Dr. Zhen Jiang Computer Science Department West Chester University
Introduction to Computer Science / Procedural – 67130
Documentation Need to have documentation in all programs
Basic Elements of C++.
Java Programming: From Problem Analysis to Program Design, 4e
CSC115 Introduction to Computer Programming
CSC141 Computer Science I Zhen Jiang Dept. of Computer Science
CSC115 Introduction to Computer Programming
Basic Elements of C++ Chapter 2.
Chapter 2.
Introduction to Programming in Java
Introduction to the C Language
CSC115 Introduction to Computer Programming
CSS 161 Fundamentals of Computing Introduction to Computers & Java
CSC115 Introduction to Computer Programming
CSC141 Computer Science I Zhen Jiang Dept. of Computer Science
Chapter 2: Basic Elements of Java
CSC530 Data Structure - Decision
CSC240 Computer Science III
Fundamentals 2.
Introduction to Primitive Data types
elementary programming
Primitive Types and Expressions
Chapter 2 Variables.
Chapter 2 Primitive Data Types and Operations
Introduction to Primitive Data types
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 Expression & operator Math.pow & Math.sqrt Combined assignment DecimalFormat String

Welcome Why this class? Job hunting Something help you to stand out! WCU graduated, Database, Software Engineering, … vs. UPenn, Temple, Drexel, … Something help you to stand out! — How do you like to be introduced?

Research project Critical thinking, communication, well-plan, etc. Real competition, deadline, pressure More realistic system, complex programming, for instance, http://www.cis.temple.edu/~jiang/RSU_Van.pptx. Student opportunities: http://www.cs.wcupa.edu/~zjiang/student_info.htm Sponsorship NSF, NSA, etc Industry interns

Student Opportunities Collaboration at international level Course project NSF REU Collaboration at inter-disciplinary level Collaborative work at inter-department level

Industry partners Such as Gnostech, Chase, etc. Invited talks in courses Seminars or guest speeches Curriculum review/assessment Permanent intern opportunities

Attract students and keep them continuously working hard Goal Competitive students entrepreneurially and computationally empowered citizenries Temple, NYU, etc. IBM, SAP, Vanguard, Bell lab, etc. Key Attract students and keep them continuously working hard Strategy Real-world computing paradigms and principles in an obstacle-less learning

No pain, no gain Need to handle those things coming from pressure: frustration, upset, madness, etc. Looking for solution, not excuse. Deadline!

Highlights in class materials (available on class website) Textbook Thinking process (instead of resultant program) Hands-on experience Happy ending!

Print-out Code 2-1 (Welcome.java), 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 Java is case-sensitive

What a println statement (one statement only) will generate the following output (one statement only)? This program prints a quote from the Gettysburg Address. "Four score and seven years ago, our 'fore fathers' brought forth on this continent a new nation." What a println statement (one statement only) will generate the following output? A "quoted" String is 'much' better if you learn the rules of "escape sequences." Also, "" represents an empty String. Don't forget to use \" instead of " ! '' is not the same as "

Variable Code 2-7 (Variable.java), 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 53 Value of variable, page 53 Execution time line, page 55

11/13/2018

Expression Operator (Increment.java) Complete list, Table 2-7, page 55 Precedence order, table 2-8, page 58 Prefix/postfix increment (decrement), page 190-191 n[x][y][pd].counter[type]++ Casting, page 65 17/3=? 17.0/3=? (double)17/3 = ?

Types, Code 2-10, page 46 Sample, Code 2-18, page 59 10% off?

Discrete Types byte short int long Continuous Types float double Non-numeric Types boolean char 11/13/2018

Type Representation Bits Bytes #Values boolean True or False 1 N/A 2 char ‘a’ or ‘7’ or ‘\n’ 16 216 = 65,536 byte …,-2,-1,0,1,2,… 8 28 = 256 short int 4 > 4.29 million long > 18 quintillion float 0.0, 10.5, -100.7 32 double 64 11/13/2018

double float long int boolean short char byte 11/13/2018

Advanced techniques Math.pow and Math.sqrt, page 62 Combined assignment, table 2-13, page 64 Scope, page 75-77

Keyboard Input Code 2-29 (Payroll.java), page 87

String Displaying message, Code 2-32, page 94 Input, converting a string to number, Code 2-33 (PayrollDialog.java), page 97 String to Number Parse, table 2-18, page 96 String value of, table 9-7, page 581 Number to String – Simple! 12+ “ ”

String processing StringDemo.java indexOf, table 9-4, page 572 substring, table 9-5, page 575 Length, Code 2-21, page 73 charAt, toLowerCase, toUpperCase, Code 2-22, page 74 Sting.valueOf, table 9-7, page 581

Example Ex 4 Self-evaluation questions: Merge 2 strings a and b? Split 1 string into 2 parts? Cut the head? Cut the tail? Take the middle? Search?