Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Following is the EmployeeTester class, which creates object of the class Employee and calls the methods of that object. The EmployeeTester class is written to

Following is the EmployeeTester class, which creates object of the class Employee and calls the methods of that object. The EmployeeTester class is written to test another class: Employee. You are required to implement the class Employee by:

  1. declaring its instance variables: name, age, salary.
  2. implementing its constructor.
  3. implementing its methods:

getEmployeeName(),

getEmployeeAge(),

getEmployeeSalary(),

setEmployeeAge(int empAge),

setEmployeeSalary(double empSalary)

public class EmployeeTester {

public static void main(String args[]) {

// Construct an object

Employee employeeOne = new Employee("Ahmad Abdullah");

// Call methods for the object

employeeOne.setEmployeeAge(30);

employeeOne.setEmployeeSalary(5000);

// Print the Employee details 
System.out.println("Name:"+ employeeOne.getEmployeeName());
System.out.println("Age:" + employeeOne.getEmployeeAge() );
System.out.println("Salary:" + employeeOne.getEmployeeSalary() ); 
 

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions