Question
Java code file. This class contains a name and IdNumber of a Sales Agent. SalesAgentTest the test program that tests all the classes and methods.
Java code file. This class contains a name and IdNumber of a Sales Agent.
SalesAgentTest
the test program that tests all the classes and methods.
1. make a new class called SalesSupervisor that inherits from SalesAgent.
- Include an instant variable named location, indicating the location for the sales
which has type String.
- Provide a toString method for printing the name of the sales supervisor,
his salary and his sales location.
2. make a class called SalesChief which inherits from SalesSupervisor.
- provide toString methods for all the classes and methods.
- Write the test program SalesAgentTest and use a name as the SalesChief in your output.
SAMPLE OUTPUT FOR SalesAgentTest
Sales Agent [name=Andrew,age=42] Sales Supervisor [super=Sales Agent [name=James,age=26],location=Perth]
SAMPLE OUTPUT FOR SalesAgentTest2
Sales Agent [name=Peter,age=56] Sales Agent [name=John,age=48] Sales Supervisor [super=Sales Agent [name=Ifeoma,age=53],location=Toronto] Sales Chief [super=Sales Supervisor [super=Sales Agent [name=Ndidi Oma,age=35],location=Ottawa]]
SalesAgent /** This class shows a Sales Agent with a name and age. */ public class SalesAgent { private String name; private int age;
/** This portion constructs a SalesAgent object. @param n the name of the Sales Agent @param a the age of the Sales Agent */ public SalesAgent(String n, int a) { name = n; age = a; }
/** Returns the string representation of the object. @return a string representation of the object */ public String toString() { return "Sales Agent [name=" + name + ",age=" + age + "]"; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Answer Below is the complete Java code with the requested classes SalesSupervisor SalesChief and the ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started