Cumberland Training Services ( CTS ) has commissioned your firm to design and de
ID: 3840035 • Letter: C
Question
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 possesses. Spartan class instructors will therefore be allocated a greater dollar amount for their teaching budget and have precedence to instruct in the newer classrooms that the firm has just constructed.
(iii) Include a derived class named Athenians. 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 excellent instructional style and is considered as almost at the top level that the firm possesses. Athenian class instructors will be allocated a dollar amount for their teaching budget, which is to be a lessor amount than the Spartan class. Athenian class instructors have secondary precedence to instructing in the newer classrooms that the firm has just constructed. Their primary instructional location in the firm’s building is within one of the older classrooms.
(iv) Include a test class that can be used to instantiate objects of the above classes.
These objects can be used to assign properties to instructors and to run any necessary
actions.
For Project Name include: Instructors
For the Main Class include Instructors
Within your Java application, create four classes using the skeletal code statements that follow.
PROJECT Java Applications: Java Inheritance
Figure 1 Source Code for the Java Inheritance Program: Class Instructors
public class Instructors
{
public Instructors() { }
}
Figure 2 Source Code for the Java Inheritance Program: Class Spartans
public class Spartans extends Instructors
{
public Spartans() { }
}
Figure 3 Source Code for the Java Inheritance Program: Class Athenians
public class Athenians extends Instructors
{
public Athenians() { }
}
Figure 4 Source Code for the Java Inheritance Program: Test Class
public class TestClass
{
public static void main(String[] args)
{
Instructors instruct = new Instructors();
Spartans sparta = new Spartans();
}
}
STEP 2 Code Your Classes
Write program code for the parent class in your application. Include any data members and methods that would match the specifications of this application, as listed on the prior page.
Then, write program code for the remaining classes that comprise this application. Of course your test class will include the main() method.
Use your own imagination as to what data values or settings would best serve the instructions for this application.
public class Instructors
{
public Instructors() { }
}
Explanation / Answer
class Instructors
{
private String name;
private int rank;
private String location;
private int knowladgeLavel;
private int budget;
public Instructors(String name,int rank,int knowladgeLavel,int budget,String location){
this.name = name;
this.setRank(rank);
this.knowladgeLavel = knowladgeLavel;
this.budget = budget;
}
public Instructors() { }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRank() {
return rank;
}
public void setRank(int rank) {
this.rank = rank;
}
public String toString(){
String str = "";
str += "Type : Instructor ";
str += "Name : "+name+" ";
str += "Rank : "+rank+" ";
return str;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public int getKnowladgeLavel() {
return knowladgeLavel;
}
public void setKnowladgeLavel(int knowladgeLavel) {
this.knowladgeLavel = knowladgeLavel;
}
public int getBudget() {
return budget;
}
public void setBudget(int budget) {
this.budget = budget;
}
}
class Athenians extends Instructors
{
public Athenians() { }
public Athenians(String name,int rank,int knowladgeLavel,int budget,String location){
super(name, rank, knowladgeLavel, budget, location);
}
public String toString(){
String str = "";
str += "Type : Athenian ";
str += "Name : "+getName()+" ";
str += "Rank : "+getRank()+" ";
return str;
}
}
class Spartans extends Instructors
{
public Spartans() { }
public Spartans(String name,int rank,int knowladgeLavel,int budget,String location){
super(name, rank, knowladgeLavel, budget, location);
}
public String toString(){
String str = "";
str += "Type : Spartan ";
str += "Name : "+getName()+" ";
str += "Rank : "+getRank()+" ";
return str;
}
}
public class TestClass {
public static void main(String[] args) {
Instructors instruct = new Instructors("Bill Wark",003,5,500,"305 ET Road ");
Instructors instruct2 = new Spartans("Wiliyam",021,7,300,"Mahatma Gandhi Road");
Instructors instruct3 = new Athenians("Rahul Yadaw",11,4,700,"Front of Jubli hils");
System.out.println("Outpur:");
System.out.println(instruct);
System.out.println(instruct3);
System.out.println(instruct2);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.