0

I have tried googling this, and looked for a while, but have not found anywhere that explains how to do this well

  SalariedEmployee salariedEmployee = 
     new SalariedEmployee("bob", "Smith", "222-22-2222", "800");

The variables are firstname, lastname, social security number, and weekly salary.

How would i change that to something where i can ask what each of the variables should be such as

  SalariedEmployee salariedEmployee = 
     new SalariedEmployee(firstName, lastName, ssn, salary);

and then ask

what is the employee's first name?
what is the employee's last name?
What is the employee's ssn?
What is the employee's salary?

If anyone can explain this, or has seen this explained somewhere else your input would be greatly appreciated.

Landon
  • 1
  • 1
  • 1
  • 1

1 Answers1

0

Read inputs from a user using a Scanner object or a Buffered Reader and save them locally. Initialize the object after you have all the inputs. Alternatively you can have set methods and assign them in any order you like.

teemo91
  • 25
  • 6