Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an Employee class and an EmployeeDemo class with the specifications described below. The EMPLOYEE_NUMBER_SEED is a static field. This means that the value is

Create an Employee class and an EmployeeDemo class with the specifications described below.

The EMPLOYEE_NUMBER_SEED is a static field. This means that the value is shared across ALL Employee objects created within a program while it is running. All Employee objects share that data field, and it only has one memory location for all objects. If one Employee object changes the value when the program is running, it changes for ALL Employee objects in that program.

Employee class

The Employee class should contain the following private data fields:

  • static int EMPLOYEE_NUMBER_SEED = 100000;
  • employeeNumber (int)
  • lastName (String)
  • firstName (String)
  • salary (double)

The Employee class should contain a constructor that:

  • Takes the lastname, firstname, and salary as parameters.
  • Sets the employeeNumber = EMPLOYEE_NUMBER_SEED
  • Increases the EMPLOYEE_NUMBER_SEED by 1.

The Employee class should contain the following additional public methods:

  • accessor (get) and mutator (set) methods for all instance variables (non-static).
  • giveRaise() method that takes an percentage that the employees salary should be increased and applies it to the salary.

EmployeeDemo class

The Employee demo class should contain the following methods:

  • A static askUser() method that prompts the user for the employees firstname, lastname, and salary, creates an Employee object using your constructor, and returns the object back to the main() method.
  • A static askRaise() method that will ask the user how percentage raise ALL employees will receive and return that as a decimal value (if user enters 8, return .08) to the main() method.
  • A static display() method that will display the contents of the object.
  • The main() method should create 3 Employee objects using the askUser() method, apply the raise to all 3 Employee objects, then print out all Employee objects with the NEW salaries, preferably formatted in a column format.
Written in Java

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago