jagomart
digital resources
picture1_Object Oriented Programming Java Pdf 198471 | Publication 3 9911 209


 121x       Filetype PDF       File size 0.47 MB       Source: www.uobabylon.edu.iq


File: Object Oriented Programming Java Pdf 198471 | Publication 3 9911 209
object oriented programming with java object interaction creating cooperating objects ahmed al ajeli lecture 4 concepts to be covered abstraction modularization classes define types object references object types primitive types ...

icon picture PDF Filetype PDF | Posted on 08 Feb 2023 | 2 years ago
Partial capture of text on file.
  Object-oriented  programming with Java 
                                    Object interaction 
                                 Creating cooperating objects 
                                                      
                                                      
                                            Ahmed Al-Ajeli 
                                                      
                          Lecture 4 
                                Concepts to be covered 
                           • abstraction 
                           • modularization 
                           • classes define types 
                           • object references  
                           • object types 
                           • primitive types 
                               
                                                                               2  
  Ahmed Al-Ajeli 
  Object-oriented  programming with Java 
                                        A digital clock 
                                                                               3  
                                       Abstraction and 
                                       modularization 
                           • Abstraction is the ability to ignore 
                              details of parts to focus attention on 
                              a higher level of a problem.  
                           • Modularization is the process of 
                              dividing a whole into well-defined 
                              parts, which can be built and 
                              examined separately, and which 
                              interact in well-defined ways.  
                                                                               4  
  Ahmed Al-Ajeli 
  Object-oriented  programming with Java 
                          Modularizing the clock display 
                                                    One four-digit display? 
                             Or two two-digit 
                             displays? 
                                                                               5  
                           Modeling a two-digit display 
                           • We call the class NumberDisplay. 
                           • Two integer fields: 
                              – The current value. 
                              – The limit for the value. 
                           • The current value is incremented 
                              until it reaches its limit. 
                           • It ‘rolls over’ to zero at this point. 
                                                                               6  
  Ahmed Al-Ajeli 
  Object-oriented  programming with Java 
                                     Implementation - 
                                       NumberDisplay 
                            public class NumberDisplay 
                            { 
                                private int limit; 
                                private int value; 
                             
                                public NumberDisplay(int limit) 
                                { 
                                    this.limit = limit; 
                                    value = 0; 
                                } 
                                ... 
                            } 
                                                                               7  
                                 Accessor and mutator  
                                             methods 
                            public int getValue() 
                            { 
                                return value; 
                            } 
                             
                            public void setValue(int replacementValue) 
                            { 
                                if((replacementValue >= 0) && 
                                   (replacementValue < limit)) { 
                                   value = replacementValue; 
                                } 
                            } 
                                                                               8  
  Ahmed Al-Ajeli 
The words contained in this file might help you see if this file matches what you are looking for:

...Object oriented programming with java interaction creating cooperating objects ahmed al ajeli lecture concepts to be covered abstraction modularization classes define types references primitive a digital clock and is the ability ignore details of parts focus attention on higher level problem process dividing whole into well defined which can built examined separately interact in ways modularizing display one four digit or two displays modeling we call class numberdisplay integer fields current value limit for incremented until it reaches its rolls over zero at this point implementation public private int accessor mutator methods getvalue return void setvalue replacementvalue if...

no reviews yet
Please Login to review.