18 Capstone

 

After reading lesson 18, you will be able to:

  • Incorporate method overloading and method overriding in an application
  • Understand how to use polymorphism in an application
  • Implement the comparable interface to compare objects in an application

The capstone for this unit concentrates on the learning objectives from lessons 13-17 but also includes everything we have learned so far in this book. The lesson starts with a set of business requirements.  Based on these requirements, I will walk through the steps to complete an application. The business problem we are going to address is providing a report of upcoming projects for a general contracting business. A general contractor is hired for various type of projects from building a house to minor repairs.  For this application, the contractor wants to keep track of the employees working on a project, the project customer’s name and address, and the start and end date for the project.

The application must be able to:

  1. Create a project with a start date, end date, customer name, address of the project, description, estimated cost, overhead percentage for the contractor, and a list of workers
  2. Print out the list of projects including the project address location
  3. Compare two projects and determine which project must be done first based on the start date

This is a small company that hires the following types of workers:

  • Electrician
  • Plumber
  • Carpenter

18.1   Creating Classes

 
 

18.1.1   The Project class

 
 
 

18.1.2   The Address Class

 

18.1.3   The Worker class

 
 

18.1.4   The Carpenter Class

 
 

18.1.5   The Electrician Class

 
 
 
 

18.1.6   The Plumber Class

 
 
 
 

18.2   Main Application

 
 

18.3   Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage