24
R. Ching MIS Department California State University, Sacramento Week 12 Week 12 Object-Oriented Programming Object-Oriented Programming Base and Derived Classes Base and Derived Classes Lab Exercise Lab Exercise

R. Ching MIS Department California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

  • View
    215

  • Download
    2

Embed Size (px)

Citation preview

Page 1: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Week 12Week 12Object-Oriented Object-Oriented ProgrammingProgramming

Base and Derived ClassesBase and Derived Classes

Lab ExerciseLab Exercise

Page 2: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

StepsSteps

• Create the classCreate the class

• Define the propertiesDefine the properties

• Create the accessor methodsCreate the accessor methods

• Create the constructorsCreate the constructors

• Create the formCreate the form

• Create the derived classesCreate the derived classes

Page 3: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Add the class from the Project menuAdd the class from the Project menu

Page 4: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Assign a name to the classAssign a name to the class

Page 5: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Define the class’ Define the class’ propertiesproperties

Page 6: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Accessor MethdodsAccessor Methdods

Add the accessor Add the accessor methodsmethods

Tests the length Tests the length of the character of the character stringstring

Page 7: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Page 8: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Page 9: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

ConstructorsConstructors

Add the Add the constructorsconstructors

Page 10: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Create the FormCreate the Form

Text boxesText boxes

Combo boxCombo box

Text boxText box

Group boxGroup box

Radio buttonsRadio buttons

ButtonsButtons

List boxList boxLabelsLabels

Page 11: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Add the SubclassesAdd the Subclasses

Page 12: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Page 13: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Constructor Constructor (the same (the same for each for each class)class)

Page 14: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Super and Super and SubclassesSubclasses

Page 15: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Define the ObjectsDefine the Objects

Objects to classesObjects to classes

ObjectObject

ClassClass

Page 16: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Button ClickedButton Clicked

Find the Find the checked radio checked radio buttonbutton

Instantiate Instantiate the objectthe object

Page 17: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Page 18: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Page 19: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Adding Shared VariablesAdding Shared Variables

Page 20: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Read-only Read-only property property proceduresprocedures

Page 21: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Temporary FixTemporary Fix

Page 22: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

When the user selects an item in the list box, When the user selects an item in the list box, the corresponding counts appear in the labelsthe corresponding counts appear in the labels

Page 23: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento

Test for the Selected ItemTest for the Selected Item

Page 24: R. Ching  MIS Department  California State University, Sacramento Week 12 Object-Oriented Programming Base and Derived Classes Lab Exercise

R. Ching MIS Department California State University, Sacramento