Assignment is: 1st Part: Define a class called Employee with the following prope
ID: 3532394 • Letter: A
Question
Assignment is:
1st Part:
Define a class called Employee with the following properties. Every Employee has a name and a salary. The constructor creates an Employee with a name and an initial salary. The method salary_change(amount) will increase or decrease the salary by the specified amount. The method quit() will set the salary of the Employee to zero. The method get_info() will return the current salary of the Employee. Write a program that lets a user create Employee objects and adjust their salaries (by raises or pay cuts). After each user command, the program must print the current salary of the Employee.
Note: A simple interface is sufficient to get user input, nothing fancy is required.
2nd Part:
Create a Faculty subclass of Employee which has the additional data of rank. Rank could be one of Assistant Professor, Associate Professor, or Professor. Create a Staff subclass of Employee which has the additional data of Category (Full or Part time). Provide suitable constructors for these classes. Each of these sub classes also have a change_status() method that changes (for example by promoting) the rank or category respectively. Add a change_status() method to the Employee base class that simply outputs a message
Explanation / Answer
Hey this is the exact corrected code for your answer ..so please rate only this one with 5 stars..So check it out.
.If you want that the system should ask you to change the employee status then just uncomment the few line lines of code in the EmployeeTest class ..just gothrough the employeeTest Class you ll get to know.
Employee Class
import java.util.Scanner;
class Employee
{
private String name;
private double salary;
Employee(String n,double s)
{
name=n;
salary=s;
}
public Employee() {
}
public void salary_change(double amount)
{
salary=salary+amount;
}
public void quit()
{
salary=0.0;
}
public double get_info()
{
return salary;
}
public void change_status()
{
System.out.println("Cannot change this Employee
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.