Object Oriented Assignment Thank You so much in advance I ne
Object Oriented Assignment (Thank You so much in advance!!!)
I need help doing the following classes:
- Janitor.java
- FloorAssociate.java (assist customer and stock shelf\'s)
- CartStacker.java
I will also be including the following below: Person.java, StoreEmployee.java, SalesAssociate.java, and Manager.java
Instructions
In the object oriented General Store we have following Classes
Person
StoreEmployee
SalesAssociate
Manager
Janitor
FloorAssociate(assist customer and stock shelf\'s)
CartStacker
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.
Write a specialized FloorAssoicate class called SalesAssociate to accompany other employees. 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: that is they have a specialized method getCashPosition() which should return
Write a StoreEmployee class Janitor to accompany other employees. Janitor work twice as many hours (80 hours/week), they make $10,000 less than general employees 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 StoreEmployee class CartStacker to accompany other employees. CartStacker are regular staff, they make 5% more money than a regular employee, they get same vacation days as general employees, and they have to work 5 more hours than a regular employee. 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 class’s vacation slips color changes, it should also be reflected in this class.
CartStacker’s getTheCartsInOrder () method should return \"Move-in! Move-in!”
Any changes to a base class should get reflected accordingly. (Example: Store employee-wide policy change to update Base Salary or vacation days or Store location for all the employees)
Create MyStore.java file to test your code and put appropriate testing code for each objects
Total Possible Points: 75
Draw a basic inheritance diagram with Class name, variables and methods that shows the inheritance relationships between the above 7 classes – 10 points (Submit as pdf or jpeg on github)
Program runs as submitted - 5 points
Design SalesAssociate Class to meet the requirements as described above – 10 points
Design Janitor Class to meet the requirements as described above – 10 points
Design CartStacker Class to meet the requirements as described above – 10 points
Write a MyStore Class to invoke the behavior of the specific Employees using their instances as asked below:
Print the salary, hours and vacation form of a SalesAssociate. Also invoke SalesAssociate specific behavior method – 10 points
Print the salary, hours and vacation days of a Janitor. Also invoke Janitor specific behavior method – 10 points
Print the salary, hours and vacation days of a CartStacker. Also print the vacation form of the CartStacker making sure it satisfies the condition mentioned in the design of the CartStacker class – 10 points
------------------------------
StoreEmployee.java
------------------------------
// 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
}
}
------------------------------------
Person.java
------------------------------
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;
}
}
---------------------------
Manager.java
-----------------------
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));
}
}
--------------------------------------
FloorAssociate.java
------------------------------------
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
}
}
------------------------
Solution
************************SalesAssociate.java*********************************************
public class SalesAssociate extends StoreEmployee {
@Override
public double getSalary() {
double sal=super.getSalary() + 10000;
double cal=(30/100)*sal;
sal=sal+cal;
return sal;//$10,000 more than general employee and 30% more
}
@Override
public int getVacationDays(){
return super.getVacationDays()+1;
}
public int getCashPosition(){
String store_loc=super.getStoreLocation();
String emp_id=super.getEmployeeId();
int cash_pos=100;
int time_st=10;
System.out.println(\"Store Location:\"+store_loc);
System.out.println(\"Employee ID:\"+emp_id);
System.out.println(\"Cash position:$\"+cash_pos);
System.out.println(\"Time stamp:\"+time_st);
return time_st;
}
}
*****************************Janitor.Java**********************************************************************
public class Janitor extends StoreEmployee {
@Override
public double getSalary() {
return super.getSalary()-10000;
}
@Override
public int getVacationDays(){
int vac=super.getVacationDays();
return vac/2;
}
@Override
public int getHours(){
int hrs=super.getHours();
return hrs*2;
}
public void clean(){
System.out.println(\"Working for General Store\");
}
}
***************************CartStacker.java******************************************************
package chegg;
public class CartStacker extends StoreEmployee {
@Override
public double getSalary() {
double sal=super.getSalary();
double calc= (5/100)* sal;
sal=sal+calc;
return sal;
}
@Override
public int getVacationDays(){
return super.getVacationDays();
}
@Override
public int getHours(){
int hrs=super.getHours();
return hrs+5;
}
@Override
public String getVacationForm() {
String s1=super.getVacationForm();
for(int i=0;i<3;i++){
System.out.print(\"\"+s1);
}
}
public void getTheCartsInOrder(){
System.out.println(\"Move-in!Move-in!\");
}
}
********************************************************completed************************************************************





