Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PROJECT Java Applications: Java Inheritance Objective To create a Java applicati

ID: 3839386 • Letter: P

Question


PROJECT Java Applications: Java Inheritance Objective To create a Java application that incorporates inheritance principles. PROJECT DESCRIPTION Cumberland Training Services (CTS) has commissioned your firm to design and develop an application that can simulate their instruction policies, procedures and processes. Your programming team has been chosen for this task and they have suggested an implementation of object oriented programming with classes, objects and inheritance. Using the skeletal starter code provided write and test the program code that will accomplish any of the above tasks, in accordance to these class definitions and specifications. (i) Include a parent class named Instructors. This class will define all the typical instructor properties and actions such as teaching budgets, locations of training classes, level of instructor knowledge, teaching materials, etc. (ii) Include a derived class named Spartans. This class will re-define an instructor to include special attributes and actions for this classification. An instructor of this class type is one that has exhibited superior instructional style and is considered as the top level that the firm

Explanation / Answer

package lab16;

import java.util.ArrayList;
import java.util.List;

public class Test {

   public static void main(String args[]) {
      
       List<String> teachingMaterials = new ArrayList<>();
       teachingMaterials.add("Introduction To Algorithm");
       teachingMaterials.add("Software Engineering Design");
      
       Instructor inst = new Instructor("Zubair", teachingMaterials);
       inst.setLevelOfKnowledge(1);
       inst.setLocationOfClass("KII9-OLD_CLASSROOM");
      
       /*
       * Creating a spartan
       */
       teachingMaterials = new ArrayList<>();
       teachingMaterials.add("Electrical Design Principles");
       teachingMaterials.add("Communication and Networking");
      
       Spartans spartan = new Spartans("Leonidas", teachingMaterials);
       spartan.setLevelOfKnowledge(3);
       spartan.setLocationOfClass("K876-NEW_CLASSROOM");

      
       /*
       * Creating an Athenian
       */
       teachingMaterials = new ArrayList<>();
       teachingMaterials.add("Civil Engineering");

       Athenians athenian = new Athenians("Achilles", teachingMaterials);
       athenian.setLevelOfKnowledge(2);
       athenian.setLocationOfClass("MY1-NEW_CLASSROOM");

      
       System.out.println(inst.toString());
       System.out.println("Spartan => " + spartan.toString());
       System.out.println("Athenian => " + athenian.toString());
      
   }
}

----------------------------------------------------------------------------------------------------------------------------------------------------


package lab16;

import java.util.List;

public class Instructor {
  
   /*
   * static constants
   */
   protected static final int HIGH_LEVEL_KNOWLEDGE = 3;
   protected static final int MEDIUM_LEVEL_KNOWLEDGE = 2;
   protected static final int PRIMARY_LEVEL_KNOWLEDGE = 1;

   protected static final int HIGH_LEVEL_BUDGET = 5000;
   protected static final int MEDIUM_LEVEL_BUDGET = 1000;
  
   protected static final String NEW_CLASSROOM_EXT = "NEW_CLASSROOM";
   protected static final String OLD_CLASSROOM_EXT = "OLD_CLASSROOM";

   /*
   * Memeber variables
   */
   private String instructorName;
   private double teachingBudget;
   private String locationOfClass;
   private int levelOfKnowledge;
   private List<String> teachingMaterials;

   public Instructor() {
       super();
   }

   public Instructor(String instructorName, List<String> teachingMaterials) {
       super();
       this.instructorName = instructorName;
       this.teachingMaterials = teachingMaterials;
   }
  
   public String getInstructorName() {
       return instructorName;
   }

   protected void setInstructorName(String instructorName) {
       this.instructorName = instructorName;
   }

   public double getTeachingBudget() {
       return teachingBudget;
   }

   protected void setTeachingBudget(double teachingBudget) {
       this.teachingBudget = teachingBudget;
   }

   public String getLocationOfClass() {
       return locationOfClass;
   }

   protected void setLocationOfClass(String locationOfClass) {
       this.locationOfClass = locationOfClass;
   }

   public int getLevelOfKnowledge() {
       return levelOfKnowledge;
   }

   protected void setLevelOfKnowledge(int levelOfKnowledge) {
       this.levelOfKnowledge = levelOfKnowledge;
   }

   public List<String> getTeachingMaterials() {
       return teachingMaterials;
   }

   protected void setTeachingMaterials(List<String> teachingMaterials) {
       this.teachingMaterials = teachingMaterials;
   }

   @Override
   public String toString() {
       return "Instructor [instructorName=" + instructorName + ", teachingBudget=" + teachingBudget
               + ", locationOfClass=" + locationOfClass + ", levelOfKnowledge=" + levelOfKnowledge
               + ", teachingMaterials=" + teachingMaterials + "]";
   }
}


----------------------------------------------------------------------------------------------------------------------------------------------------


package lab16;

import java.util.List;

public class Spartans extends Instructor {
  
   public Spartans() {
       super();
   }

   public Spartans(String instructorName, List<String> teachingMaterials) {
       super(instructorName, teachingMaterials);
   }
  
   @Override
   public void setLevelOfKnowledge(int levelOfKnowledge) {
       if (levelOfKnowledge >= HIGH_LEVEL_KNOWLEDGE) {
           super.setLevelOfKnowledge(levelOfKnowledge);
       }
   }
  
   @Override
   public void setTeachingBudget(double teachingBudget) {
       if (teachingBudget >= HIGH_LEVEL_BUDGET) {
           super.setTeachingBudget(teachingBudget);
       }
   }
  
   @Override
   protected void setLocationOfClass(String locationOfClass) {
       if (locationOfClass.endsWith(NEW_CLASSROOM_EXT)) {
           super.setLocationOfClass(locationOfClass);
       }
   }
}


----------------------------------------------------------------------------------------------------------------------------------------------------

package lab16;

import java.util.List;

public class Athenians extends Instructor {
  
   public Athenians() {
       super();
   }
  
   public Athenians(String instructorName, List<String> teachingMaterials) {
       super(instructorName, teachingMaterials);
   }
  
   @Override
   public void setLevelOfKnowledge(int levelOfKnowledge) {
       if (levelOfKnowledge >= MEDIUM_LEVEL_KNOWLEDGE && levelOfKnowledge < HIGH_LEVEL_KNOWLEDGE) {
           super.setLevelOfKnowledge(levelOfKnowledge);
       }
   }
  
   @Override
   public void setTeachingBudget(double teachingBudget) {
       if (teachingBudget >= MEDIUM_LEVEL_BUDGET && teachingBudget < HIGH_LEVEL_BUDGET) {
           super.setTeachingBudget(teachingBudget);
       }
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote