Skip to Main Content

Japanese

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Create a Employee Class

jagbir singhOct 9 2014 — edited Oct 9 2014

Hello, Kindly help me , to create a Employee class as per given requirements. Requirements are given below as:

Create a class called Employee that includes three pieces of information as instance variables:

  • Employee ID (string type)
  • first name (string type) (default value ‘John’)
  • last name (string type) (default value ‘Smith’) and
  • monthly salary (type double).
  • No argument constructor that initializes the three instance variables. The employee id should be generated using the following process:

The employee id should be a combination of first initial, last initial and a number starting from 10001 for the first employee and increasing by one for each employee. e.g. if John Smith is the first employee then its id will be JS10001 and if George Brown is the second employee then its id will be GB10002

  • Provide get and set methods for each instance variable. The set method for monthly salary should ensure that its value remains positive – if an attempt is made to assign a negative value, leave the original value.

thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 6 2014
Added on Oct 9 2014
1 comment
1,556 views