Question
Instructions In the object oriented General Store we have following Classes Person Types of Employees: StoreEmployee SalesAssociate Manager Janitor FloorAssociate (assist customer and stock shelf's)
Instructions
In the object oriented General Store we have following Classes
Person
Types of Employees:
StoreEmployee
SalesAssociate
Manager
Janitor
FloorAssociate (assist customer and stock shelf's)
CartStacker
Identify all the variables and methods required for different types of employees and use them in your Java classes. If all required variables and methods are not included, MARKS will be deducted.
Person, Manager, FloorAssociate and StoreEmployee classes are already provided in sample code. Build additional classes based on following inheritance hierarchy.
Each type of employee in the General Store extends at least a common base class (StoreEmployee). A specialized type of one of the Employee types already existing in the System will extend as appropriate (next point describes this scenario).
Write a specialized FloorAssoicate class called SalesAssociate. SalesAssociate are experienced staff, they make 30% more money than a FloorAssociate and they get 1 additional vacation day.
SalesAssociate have to fill out cash position report at the beginning and end of their daily work: for this include a specialized method called getCashPosition() in your class which should return (Identify variables and methods required using the following snippet):
Store location: Rutgers Campus, New Brunswick, NJ
Employee ID: E0001
Cash position: $$ // any random dollar amount: hardcoded or via an instance variable getter/setter
Time Stamp:
Write a class Janitor (of type StoreEmployee). Janitor work twice as many hours (80 hours/week), they make $10,000 less than general employees(StoreEmployee) i.e. 20K, they get half as much vacation (i.e 5 days), and they have an additional method named clean() that prints "Working for the General Store."
Write a class CartStacker (of type StoreEmployee). CartStacker are regular staff, they make 5% more money than a regular employee, they get same vacation days as general employees, and they work 5 hours more than a regular employee (as shown in StoreEmployee class). They have to fill out 3 vacation slips in order to get a vacation. So their getVacationForm() method should return YellowYellowYellow. Note: If the parent classs vacation slips color changes, it should also be reflected in this class, in short, YellowYellowYellow is not to be encoded in getVacationForm(). No marks will be awarded if this is done.
CartStackers getTheCartsInOrder () method should return "Move-in! Move-in!
Any changes to a base class should get reflected accordingly. (Example: Store employee-wide policy changes to update Base Salary or vacation days or Store location, should be reflected for all the employee-types). Use Inheritance and Polymorphism.
Create MyStore.java file to test your code and put appropriate testing code for each objects. (Students who dont include this tester file will be heavily penalized)
Person Class
public abstract class Person { private String firstName; private String lastName; public Person(String firstName, String lastName) { super(); this.firstName = firstName; this.lastName = lastName; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName;
StoreEmployee Class
// A class to represent behavior common to all type of General Store employees. public class StoreEmployee extends Person{ private String employeeId; /** * Takes * @param firstName * @param lastName * @param employeeId */ public StoreEmployee(String firstName, String lastName, String employeeId) { super(firstName, lastName); this.employeeId=employeeId; } public String getEmployeeId() { return employeeId; } public int getHours() { return 40; // Standard employee works 40 hours / week } public double getSalary() { return 30000.0; // Base Salary of $30,000.00 / year } public int getVacationDays() { return 10; // Base Vacation - 2 weeks } public String getVacationForm() { return "yellow"; // use the yellow vacation slip } public String getStoreLocation() { return "Rutgers Campus, New Brunswick, NJ";//address of the store where all the employee works for this store } }
Manager Class
import java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; // A class to represent GeneralStore Manager. public class Manager extends StoreEmployee { // Constructor public Manager(String firstName, String lastName, String employeeId) { super(firstName, lastName, employeeId); } public void monitorEmployees() { System.out.println("Monitoring Empoyees work! Great Job! Keep it going!"); } public void assignWork(StoreEmployee employee) { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); System.out.println(dateFormat.format(date)); System.out.println("Assigning Work to: Associate Name:" + employee.getFirstName() + " " +employee.getLastName() + " Associate Employee ID:" + employee.getEmployeeId() + " @ " + dateFormat.format(date)); } }
Floor Associate
public class FloorAssociate extends StoreEmployee { // Constructor public FloorAssociate(String firstName, String lastName, String employeeId) { super(firstName, lastName, employeeId); } /** * Identify yourself and approach Customers Politely * @return */ public String assistCustomers(){ return "This is " + getFirstName() + ". How may I help you?"; } /** * Stack the shelves where necessary/ */ public void stockShelves(){ System.out.println("Empty? Load it up!"); } @Override public double getSalary() { return super.getSalary() + 10000;//$10,000 more than general employee } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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