class08 Notes

class08 Notes - 1 1 IST 240 Today Thu(2/7 ¢ Chapter 5...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 1 IST 240 ¡ Today: Thu (2/7) ¢ Chapter 5: Writing classes! ¡ In-class exercise ¢ Upload zipped Student.java, StudentClient.java, Valedictorian.java ¢ Review by Jung-woo Monday eve 6-7pm in IST 206 ¡ Come with questions! ¡ Tue (2/12) ¢ Exam #1: Ch 1-4 ¡ Exam has apprx 11 multiple choice and 12 short answer ¡ Can bring 1 cheat sheet (8.5 x 11, both sides) ¢ No laptop, no book ¡ Exam is whole period (if you finish early, you can leave) ¡ Thu (2/14) ¢ Ch 5: UML Intro + more classes 2 5.1 – Identifying Classes and Objects ¡ Remember that a class represents a group (classification) of objects with the same behaviors ¡ Generally, classes that represent objects should be given names that are singular nouns ¡ Examples: Coin , Student , Message ¡ A class represents the concept of one such object ¡ We are free to instantiate as many of each object as needed 2 3 5.1 – Identifying Classes and Objects ¡ Recall from our overview of objects in Chapter 1 that an object has state and behavior ¡ Consider a university student object ¢ it’s state can be defined as the student’s name, address, major, and GPA ¢ it’s primary behavior may be to update the address or to recalculate the GPA ¡ We can represent a student in software by designing a class called Student that models this state and behavior ¢ the class serves as the blueprint for a student object ¡ We can then instantiate as many student objects as we need for any particular program 4 5.1 – Classes ¡ A class can contain data declarations and method declarations String name; double gpa; Data declarations Method declarations 3 5 5.2 – Instance Data ¡ We can depict the two Student objects from the StudentClient program as follows student1 Sooyeon name Each object maintains its own name and gpa variable, and thus its own state gpa 3.8 student2 Alex name gpa 3.75 6 Student.java ¡ Let’s write a Student class with...
View Full Document

This note was uploaded on 03/31/2008 for the course IST 240 taught by Professor Tracymullen during the Spring '08 term at Penn State.

Page1 / 11

class08 Notes - 1 1 IST 240 Today Thu(2/7 ¢ Chapter 5...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online