Download presentation
Presentation is loading. Please wait.
1
CS1101: Programming Methodology http://www.comp.nus.edu.sg/~cs1101/ http://www.comp.nus.edu.sg/~cs1101/
2
Week 3: Numerical Data and OOP Basics Last week: Chapter 1: Intro to OOP and S/W Development Chapter 2: Getting Started with Java DrJava CourseMarker This week: Take-home lab #1 Chapter 3: Numerical Data Chapter 4: Defining Your Own Classes – Part 1 Next week: Chapter 4: Defining Your Own Classes – Part 1 (cont’d) Chapter 5: Selection Statements © CS1101 (AY2009-2010 Semester 1)Week3 - 2
3
Reminder Have you read the relevant chapters and PowerPoint files BEFORE coming to this lecture? Have you been filling your Progress Chart? © CS1101 (AY2009-2010 Semester 1)Week3 - 3
4
Chapter 3 Numerical Data Any questions on Chapter 3? We’ll skip GregorianCalendar class. © CS1101 (AY2009-2010 Semester 1)Week3 - 4
5
What are the answers? (1/2) (int) 23.82 = 30 % 7 = 30 / 7 = 30.0 / 7 = 30 / 7.0 = 30.0 / 7.0 = (double) 30 / 7 = 30 / (double) 7 = (double) (30 / 7) = © CS1101 (AY2009-2010 Semester 1)Week3 - 5 +
6
What are the answers? (2/2) 1 + 2 + 3 + "Java" = "Java" + 1 + 2 + 3 = "Java" + (1 + 2 + 3) = 1 + "Java" + 2 + 3 = 1 + 2 + "Java" + 3 = © CS1101 (AY2009-2010 Semester 1)Week3 - 6 +
7
Temperature Conversion The following is the formula to convert temperature in degree Fahrenheit to Celsius: C = (5/9) × (F – 32) Download “Ch3TemperatureConvert.java” and test it. Why doesn’t it work? Can you correct the program? Note: This type of error is very common! © CS1101 (AY2009-2010 Semester 1)Week3 - 7
8
Loan Calculator Let’s study the development of this program. © CS1101 (AY2009-2010 Semester 1)Week3 - 8
9
Take-home lab assignment #1 It has been released. Deadline is next Monday, 31 August 2009, 23:59hr. Any questions? © CS1101 (AY2009-2010 Semester 1)Week3 - 9
10
Java API Documentation (1/2) A very important website http://java.sun.com/javase/6/docs/api/ http://java.sun.com/javase/6/docs/api/ © CS1101 (AY2009-2010 Semester 1)Week3 - 10 Bookmark it!
11
Java API Documentation (2/2) It’s impossible to cover everything about a standard (built-in) class, so you need to look it up yourself. For example, in take-home lab #1, you need to look for these yourself: Exercise 1: What is the maximum integer value in Java? Exercise 3: What is the method in Scanner class to read the user’s input as a line of text? Exercise 4: What is the appropriate method in Math class to compute the hypothenuse? © CS1101 (AY2009-2010 Semester 1)Week3 - 11
12
Chapter 4 Defining Your Own Classes – Part 1 Let’s go to Chapter 4. © CS1101 (AY2009-2010 Semester 1)Week3 - 12
13
Summary for Today What are numerical data types? Performing computation on numerical data Some standard (built-in) classes DecimalFormat Scanner Math Random API documentation page How to define and use your own class (to be continued next week) © CS1101 (AY2009-2010 Semester 1)Week3 - 13
14
Announcements/Things-to-do Take-home lab #1 deadline: 31 August 2009, Monday, 23:59hr. To prepare for next week’s lecture: Read Chapter 4 (again) and Chapter 5 and their PowerPoint files before you come for lecture. Do Quick Check questions in Chapter 4. Check out the answers (on CS1101 website) yourself. To prepare for next week’s discussion session: Download “week4_discussion_qns.pdf” from module website, “CA – Discussion”. Do the questions before you attend your discussion session. © CS1101 (AY2009-2010 Semester 1)Week3 - 14
15
End of File © CS1101 (AY2009-2010 Semester 1)Week3 - 15
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.