SE1011 Week 6, Class 1 Today Return Half Exam 2 (cont.) Object Oriented Programming (cont.) Muddiest...
-
Upload
elaine-flowers -
Category
Documents
-
view
215 -
download
0
Transcript of SE1011 Week 6, Class 1 Today Return Half Exam 2 (cont.) Object Oriented Programming (cont.) Muddiest...
SE1011Week 6, Class 1 Today
Return Half Exam 2 (cont.) Object Oriented Programming (cont.) Muddiest Point
Next Half Exam: Week 7, Monday
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 1
Muddiest PointHow the class return the value to the main program? How to choose this variables to be returned? return valuehow to use the info we generated in clock ideas into separate pieces of code design to codeformatter versus printf formatterHow does any of this actually work? seeing Clock in action would have helped. clock in actionHardest part to me would be what is "private" exactly? public/privateWhere to create a new class for an object, and when to incorporate that info into the main class multiple classesThe first part of the lecture, how to differentiate between an object and an instance o a class object/instance
2
Muddiest Point (2)more uses for formater? formatterJava standards on what to make public and what to make private public/privatedo you have to make a separate class for the objects you create?
multiple classes
how are you supposed to get the clock to count and show on its own. clock in actionpublic vs. private\ public/privateWhat exactly is an address? Are they useful? addressshould the lab be in console or GUI? lab 5Are methods just functions in a class? methods
3
IEEE Xtreme Competition
24 hour programming competition Deadline for registration is tomorrow – see
your email I will proctor a few hours of the competition If you have prior programming experience, I
recommend the competition If you have lots of free time, I also
recommend it, regardless of your experience level
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 4
Object Oriented Programming
Why use object oriented programming (OOP)? Natural way to
model real-world objects describe computing components
Encapsulation! Present clean interface and behavior to users Users don't have to know internals to use Helps detect and correct for errors
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 5
What is an Object?
A class defines a new type of object An object is an instance of a class with
its own values for instance variables behaviors performed using its own instance
variables Unlike primitive …
types, class types are defined based on other types, and define behaviors
values, objects have behaviors variables, a variable with a class type actually
holds a reference, not the object directly 6
How to copy a class?
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 7
12
inputHour
int
285638
Clock
11
hours
int
31
minute
int
285652
Clock
11
hours
int
31
minute
int
SE1011Week 6, Class 1
Clock ref
clock
Clock ref
clock2
285638
285652
main(…)
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 8
Acknowledgement
This course is based on the text
Introduction to Programming with Java by Dean & Dean, 2nd Edition
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 9