Personal tools
You are here: Home Comp 170 Introduction to OOP Lab Materials Lab11 ReadMe.txt
Document Actions

ReadMe.txt

by Dr. William L. Honig last modified 2006-04-12 09:35 PM

Lab11 Instructions - Follow Carefully if you want points!

Click here to get the file

Size 2.5 kB - File type text/plain

File contents

------------------------------------------------------------------------
Instructions for Lab11
------------------------------------------------------------------------

PROJECT TITLE: Lab11 - People Inheritance
PURPOSE OF PROJECT:
VERSION or DATE: 12 April 06
AUTHORS: W.L.Honig
USER INSTRUCTIONS:

1.  Use your current Person class.  Make this change:
    add one accessor getStringIDNumber() that returns a String object created 
    from the stored current value of the attribute.  Do *not* change the type
    of the attribute.
    
    HINT: static method  String.valueOf may be useful to convert int to String.
    
    NOTE: you will need your Car class too to compile Person!
    
2.  Add a Student and Teacher Class that are subclasses of Person.  For each:
    add attributes appropriately to store the additional information beyond what is
    stored for Person objects. 
    
    Student has a "year" to note if they are senior, junior, etc.
    
    Teacher has a "department that they belong to.
    
3.  Each of the new classes has a constructor that sets up the new information as
    as well as using the Person constructor to set up gender.
    
4.  Each of the new classes overrides the new getStringIDNumber method with a
    new accessor specialized for the subclass.
    
    for Student, it returns a String object of "S" concatentated with the numeric
    idNumber
    
    for Teacher, it returns a String object of "T" ...
    
    Do *NOT* change the stored value of the attribute *anywhere* - This accessor has
    to do some work   :-)
    
5.  When you have the above done and it all compiles, do your testing on the BlueJ 
    object bench:
        Create 3 people
        Create 3 students
        Create 3 teachers
        
        Use the object bench to give the objects some interesting attribute values.  
        Notice how the subclass objects can use the superclass methods.
        
        Be prepared to show us how your new method works for people, students, and teachers.
        Show us how you wrote the code for the new constructors and new methods.
        
6.  OPTIONAL PART WHEN THE ABOVE IS DONE:
        Update the class hierarchy as appropriate to have a unique id number assigned to each
        person, teacher, and student.  (one set of id numbers with no duplication).
        
7.  FURTHER OPTIONAL PART:
        (Getting ready to P9 !!!!!)
        Design and create a Marriage object that records that two people are married.       
        
        
« January 2023 »
Su Mo Tu We Th Fr Sa
1234567
891011121314
15161718192021
22232425262728
293031
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: