CSC 141 Computer Science I Zhen Jiang Dept

  • Slides: 25
Download presentation
CSC 141 Computer Science I Zhen Jiang Dept. of Computer Science West Chester University

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

Table of Contents Introduction n n n n Plain text format printout Variable and

Table of Contents Introduction n n n n Plain text format printout Variable and its value type Expression & operator Math. pow & Math. sqrt Combined assignment Decimal. Format String

Welcome n Why this class? n Job hunting WCU graduated, Database, Software Engineering, …

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

n Research project n n n Critical thinking, communication, well-plan, etc. Real competition, deadline,

n Research project n n n 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_inf o. htm Sponsorship n n NSF, NSA, etc Industry interns

Student Opportunities Collaboration at internationa level Course project NSF REU Collaboration at inter-disciplinary level

Student Opportunities Collaboration at internationa level Course project NSF REU Collaboration at inter-disciplinary level Collaborative work at interdepartment level

§ Industry partners • • • Such as Gnostech, Chase, etc. Invited talks in

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

Goal • Competitive students entrepreneurially and computationally empowered citizenries Temple, NYU, etc. IBM, SAP,

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 n Need to handle those things coming from pressure:

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

n n n Highlights in class materials (available on class website) Textbook Thinking process

n n n Highlights in class materials (available on class website) Textbook Thinking process (instead of resultant program) Difficulty Hands-on experience Happy ending! class sample class project/HW exercises quiz test final

Print-out n Code 2 -1 (Welcome. java), page 27 n n n n Names

Print-out n Code 2 -1 (Welcome. java), page 27 n n n n 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

n What a println statement (one statement only) will generate the following output (one

n 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. " n 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 n Code 2 -7 (Variable. java), page 39 n n Type (declaration) Name,

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

Assignment n n Assignment n Left is a single variable n Right is a

Assignment n n Assignment n Left is a single variable n Right is a legal expression Initialization, page 53 Value of variable, page 53 Execution time line, page 55

10/17/2021 15

10/17/2021 15

Expression n Operator (Increment. java) n n n Complete list, Table 2 -7, page

Expression n Operator (Increment. java) n n n 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]++ n Casting, page 65 n 17/3=? n 17. 0/3=? n (double)17/3 = ?

n n Types, Code 2 -10, page 46 Sample, Code 2 -18, page 59

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

Discrete Types byte short int long 10/17/2021 Continuous Types float double Non-numeric Types boolean

Discrete Types byte short int long 10/17/2021 Continuous Types float double Non-numeric Types boolean char 18

Type Bits Bytes #Values boolean Representatio n True or False 1 N/A 2 char

Type Bits Bytes #Values boolean Representatio n True or False 1 N/A 2 char ‘a’ or ‘ 7’ or ‘n’ 16 2 216 = 65, 536 byte …, -2, -1, 0, 1, 2, … 8 1 28 = 256 short …, -2, -1, 0, 1, 2, … 16 2 216 = 65, 536 int …, -2, -1, 0, 1, 2, … 4 > 4. 29 million long …, -2, -1, 0, 1, 2, … 8 > 18 quintillion float 0. 0, 10. 5, -100. 7 32 double 0. 0, 10. 5, -100. 7 64 10/17/2021 19

double float long int char boolean short byte 10/17/2021 20

double float long int char boolean short byte 10/17/2021 20

Advanced techniques n n n Math. pow and Math. sqrt, page 62 Combined assignment,

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

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

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

String n n Displaying message, Code 2 -32, page 94 Input, converting a string

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

String processing n String. Demo. java n index. Of, table 9 -4, page 572

String processing n String. Demo. java n index. Of, table 9 -4, page 572 n substring, table 9 -5, page 575 n Length, Code 2 -21, page 73 n char. At, to. Lower. Case, to. Upper. Case, Code 2 -22, page 74 n Sting. value. Of, table 9 -7, page 581

Example n n Ex 4 Self-evaluation questions: n Merge 2 strings a and b?

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