Answered Essay: Create an Employee class as per the following specifications:

Can someone please write this program in Java? Thank you.

Create an Employee class as per the following specifications:

-three private instance variables: firstName (String), lastName(String), and salary (double)

-a single constructor with three arguments: the first name, the last name and the salary. In the constructor, initialize the instance variables with the provided parameter values.

-get and set methods for each of the instance variables.

-A computation method, calculateSalary, that takes the percent raise as a decimal value for its argument. The method returns the new salary using the calculation: salary + salary * raise%

-A toString method to return a string containing all information stored about the employee

Using the Employee class as a parent, write a child class called Manager that inherits all methods and attributes from Employee plus contains:

-An attribute of bonus (double)

-Methods that set and get the bonus

-An appropriate constructor that will set all instance variables

-An overridden computation method, calculateSalary, that takes the percent raise as a decimal value as its argument. The method returns the new salary using the calculation: salary + salary * raisepercent + bonus

-A toString method to return a string containing all information stored about the manager.

In another class, create a driver program that will:

-Create an employee object for Bob Smith who has a current salary of $45,000.

-Create a manager object for Sally Jones who has a current salary of $65,000 and a bonus of $6,500.

-Set Bob’s salary to the new calculated salary for next year based on giving him a 3% raise.

-Set Sally’s salary to the new calculated salary for next year based on giving her a 5% raise.

-Use the appropriate toString methods for Bob and Sally to output their new information to the user.

Expert Answer

 

Employee.java

public class Employee {

private String firstName ;

private String lastName;

private double salary;

public Employee(String firstName, String lastName, double salary) {

super();

this.setFirstName(firstName);

this.setLastName(lastName);

this.setSalary(salary);

}

public double calculateSalary(double raise) {

setSalary(getSalary()+ getSalary() * raise/100);

return getSalary();

}

public String employeedetails() {

return getFirstName().toString()+ getLastName().toString()+ Double.toString(getSalary()) ;

}

public double getSalary() {

return salary;

}

public void setSalary(double salary) {

this.salary = salary;

}

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

public class Manager extends Employee {

private double bonus;

public Manager(String firstName, String lastName, double salary, double bonus) {

super(firstName, lastName, salary);

this.bonus = bonus;

}

public double getBonus() {

return bonus;

}

public void setBonus(double bonus) {

this.bonus = bonus;

}

public Manager(String firstName, String lastName, double salary) {

super(firstName, lastName, salary);

// TODO Auto-generated constructor stub

}

public double calculateSalary(double raise) {

setSalary(getSalary() + getSalary()* raise/100 + bonus);

return getSalary();

}

public String ManagerDetails() {

return getFirstName().toString()+ getLastName().toString()+ Double.toString(getSalary()) ;

}

}

——————————————————————————————————————————

Driver.java

public class Driver {

public static void main (String [] args) {

Employee Bob_smith = new Employee(“Bob”, “Smith”, 45000) ;

Manager Sally_Jones = new Manager(“Sally”, “Jones”, 65000, 6500);

Bob_smith.setSalary(Bob_smith.calculateSalary(3));

Sally_Jones.setSalary(Sally_Jones.calculateSalary(5));

System.out.println(Bob_smith.employeedetails());

System.out.println(Sally_Jones.ManagerDetails());

}

}

 

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?