SlideShare a Scribd company logo
Week11 Inheritance class relationships in Java
Week11 Inheritance class relationships in Java
In-common Characteristics
• Rent amount
• Address
• Bedrooms
• Baths
• Amenities
• Parking Spaces
• Is ADA Accessible
• Pets
• Deposit
• Laundry OnSite
• Schools
• Heating/Cooling
• Square Feet
• Has a yard
• Unit Number
Apartment Characteristics
• Rent amount
• Address
• Bedrooms
• Baths
• Amenities
• Parking Spaces
• Is ADA Accessible
• Pets
• Deposit
• Laundry OnSite
• Schools ??
• Heating/Cooling
• Square Feet
• Has a yard
• Unit Number
House Characteristics
• Rent amount
• Address
• Bedrooms
• Baths
• Amenities
• Parking Spaces ??
• Is ADA Accessible
• Pets
• Deposit
• Laundry OnSite
• Schools
• Heating/Cooling
• Square Feet
• Has a yard
• Unit Number??
Rental Attributes
• Rent amount
• Address
• Bedrooms
• Baths
• Amenities
• Parking Spaces
• Is ADA Accessible
• Pets
• Deposit
• Laundry OnSite
• Schools
• Heating/Cooling
• Square Feet
• Has a yard
• Unit Number
House Attributes
• Rent amount
• Address
• Bedrooms
• Baths
• Amenities
• Parking Spaces
• Is ADA Accessible
• Pets
• Deposit
• Laundry OnSite
• Schools
• Heating/Cooling
• Square Feet
• Has a yard
• Unit Number
Apartment Attributes
• Rent amount
• Address
• Bedrooms
• Baths
• Amenities
• Parking Spaces
• Is ADA Accessible
• Pets
• Deposit
• Laundry OnSite
• Schools
• Heating/Cooling
• Square Feet
• Has a yard
• Unit Number
Building Attributes
Definitely
• Building Name
• Amenities
Questionable
• is ADA Accessible??
• Laundry Onsite??
• Address??
• Number of Units??
Class Structure
Rental Class
• Rent Amount
• Address
• Bedrooms
• Baths
• is ADA Accessible
House Class
• has Yard
Apartment Class
• Unit Number
• Parking Spaces
• Building
Building Class
• Building Name
• has Pool
Class Structure
Rental Class
• Rent Amount
• Address
• Bedrooms
• Baths
• is ADA Accessible
House Class
• has Yard
Apartment Class
• Unit Number
• Parking Spaces
• Building
Building Class
• Building Name
• has Pool
inherits from
inherits from Contains an
instance of a
building – but
does not inherit
from Building
Class Structure
Rental Class
• Rent Amount
• Address
• Bedrooms
• Baths
• is ADA Accessible
House Class
• has Yard
Apartment Class
• Unit Number
• Parking Spaces
• Building
Building Class
• Building Name
• has Pool
Rental
House Apartment
Classes
Building
Where we make objects and view them Tester class
(main method)
Lease
Lease Attributes
• Either an apartment or
a house
• Start Date/Time
• End Date/Time
• Renter
Lease Attributes
• Either an apartment or
a house
• Start Date/Time
• End Date/Time
• Renter
Renter Class
• First Name
• Last Name
• Phone Number
Use the generic Rental
class and then we can
use ANY subclasses that
inherit from Rental
Rental
House Apartment
Classes
Building
Where we make objects and view them Tester class
(main method)
Lease
Renter
Class Structure
Rental Class
• Rent Amount
• Address
• Bedrooms
• Baths
• is ADA Accessible
House Class
• has Yard
Apartment Class
• Unit Number
• Parking Spaces
• Building
Building Class
• Building Name
• has Pool
inherits from
inherits from
Lease Class
• Rental
• Start date/time
• End date/time
• Renter
Renter Class
• First Name
• Last Name
• Phone Number
RentalTester Class
(with main method)
Rental Tester Class
• Create a house
• Create an apartment
• Create a building
• Assign the apartment to the building
• Create two renters
• Create two leases
• Assign a house and renter to a lease
• Assign an apartment and a renter to a lease
• Create an arraylist of leases and print out the
results using an enhanced for loop

More Related Content

PPTX
Logic and Coding of Java Interfaces & Swing Applications
kjkleindorfer
 
PPTX
Week10 packages using objects in objects
kjkleindorfer
 
PPTX
Week9 Intro to classes and objects in Java
kjkleindorfer
 
PPTX
Intro to Bootstrap
kjkleindorfer
 
PPTX
Layouts Part 2
kjkleindorfer
 
PPTX
Layouts
kjkleindorfer
 
PPTX
Using PHP to submit forms
kjkleindorfer
 
PPTX
Forms Part 1
kjkleindorfer
 
Logic and Coding of Java Interfaces & Swing Applications
kjkleindorfer
 
Week10 packages using objects in objects
kjkleindorfer
 
Week9 Intro to classes and objects in Java
kjkleindorfer
 
Intro to Bootstrap
kjkleindorfer
 
Layouts Part 2
kjkleindorfer
 
Layouts
kjkleindorfer
 
Using PHP to submit forms
kjkleindorfer
 
Forms Part 1
kjkleindorfer
 

Recently uploaded (20)

PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PDF
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
CDH. pptx
AneetaSharma15
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PPTX
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
CDH. pptx
AneetaSharma15
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
Ad
Ad

Week11 Inheritance class relationships in Java

  • 3. In-common Characteristics • Rent amount • Address • Bedrooms • Baths • Amenities • Parking Spaces • Is ADA Accessible • Pets • Deposit • Laundry OnSite • Schools • Heating/Cooling • Square Feet • Has a yard • Unit Number
  • 4. Apartment Characteristics • Rent amount • Address • Bedrooms • Baths • Amenities • Parking Spaces • Is ADA Accessible • Pets • Deposit • Laundry OnSite • Schools ?? • Heating/Cooling • Square Feet • Has a yard • Unit Number
  • 5. House Characteristics • Rent amount • Address • Bedrooms • Baths • Amenities • Parking Spaces ?? • Is ADA Accessible • Pets • Deposit • Laundry OnSite • Schools • Heating/Cooling • Square Feet • Has a yard • Unit Number??
  • 6. Rental Attributes • Rent amount • Address • Bedrooms • Baths • Amenities • Parking Spaces • Is ADA Accessible • Pets • Deposit • Laundry OnSite • Schools • Heating/Cooling • Square Feet • Has a yard • Unit Number
  • 7. House Attributes • Rent amount • Address • Bedrooms • Baths • Amenities • Parking Spaces • Is ADA Accessible • Pets • Deposit • Laundry OnSite • Schools • Heating/Cooling • Square Feet • Has a yard • Unit Number
  • 8. Apartment Attributes • Rent amount • Address • Bedrooms • Baths • Amenities • Parking Spaces • Is ADA Accessible • Pets • Deposit • Laundry OnSite • Schools • Heating/Cooling • Square Feet • Has a yard • Unit Number
  • 9. Building Attributes Definitely • Building Name • Amenities Questionable • is ADA Accessible?? • Laundry Onsite?? • Address?? • Number of Units??
  • 10. Class Structure Rental Class • Rent Amount • Address • Bedrooms • Baths • is ADA Accessible House Class • has Yard Apartment Class • Unit Number • Parking Spaces • Building Building Class • Building Name • has Pool
  • 11. Class Structure Rental Class • Rent Amount • Address • Bedrooms • Baths • is ADA Accessible House Class • has Yard Apartment Class • Unit Number • Parking Spaces • Building Building Class • Building Name • has Pool inherits from inherits from Contains an instance of a building – but does not inherit from Building
  • 12. Class Structure Rental Class • Rent Amount • Address • Bedrooms • Baths • is ADA Accessible House Class • has Yard Apartment Class • Unit Number • Parking Spaces • Building Building Class • Building Name • has Pool
  • 13. Rental House Apartment Classes Building Where we make objects and view them Tester class (main method) Lease
  • 14. Lease Attributes • Either an apartment or a house • Start Date/Time • End Date/Time • Renter
  • 15. Lease Attributes • Either an apartment or a house • Start Date/Time • End Date/Time • Renter Renter Class • First Name • Last Name • Phone Number Use the generic Rental class and then we can use ANY subclasses that inherit from Rental
  • 16. Rental House Apartment Classes Building Where we make objects and view them Tester class (main method) Lease Renter
  • 17. Class Structure Rental Class • Rent Amount • Address • Bedrooms • Baths • is ADA Accessible House Class • has Yard Apartment Class • Unit Number • Parking Spaces • Building Building Class • Building Name • has Pool inherits from inherits from Lease Class • Rental • Start date/time • End date/time • Renter Renter Class • First Name • Last Name • Phone Number RentalTester Class (with main method)
  • 18. Rental Tester Class • Create a house • Create an apartment • Create a building • Assign the apartment to the building • Create two renters • Create two leases • Assign a house and renter to a lease • Assign an apartment and a renter to a lease • Create an arraylist of leases and print out the results using an enhanced for loop