Java – Four class template.

In the grade 12 exam you are expected to write applications with at least four classes i.e.

  1. A UI class. Creates the manager class object. Calls the methods it needs. May have some input and output.
  2. A manager class for all your methods.
  3. A template (parent) class from which you will instantiate objects. Will have a constructor,  “getter” and “setter” methods and a toString method.
  4. A template class that is a derived class (child class). This class will extend the parent class mentioned above. Will have its own constructor,  “getter” and “setter” methods and a toString method.

An important technique is to write a bare-bones class with very little code, BUT it runs. THEN you can study the exam paper and begin to add the specifics. Obviously name the classes to match the exam paper.

Here is a template model of a four class application for you to study and use in your exams. Click on the links and download – you may have to open it in Wordpad before you cut-and-paste the code into NetBeans where you can run it.

UI Class

Manager Class

Template (parent) class from which to create objects

Template (child) class from which to create child objects

Overview text document.

 OUTPUT: see below

 Java coding for schools