Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class EmployeeTest {
- public static void main(String[] args) {
- Employee employee1 = new Employee("Kyle", "Bentley", 5000.00);
- Employee employee2 = new Employee("Dave", "Skinner", 8500.00);
- //prints Kyle
- System.out.println(employee1.getFirstName());
- //change employee1 name to Matt
- employee1.setFirstName("Matt");
- System.out.println(employee1.getFirstName());
- //blank line
- System.out.println();
- //prints Bentley
- System.out.println(employee1.getLastName());
- //change employee1 last name to Smith
- employee1.setLastName("Smith");
- System.out.println(employee1.getLastName());
- //blank line
- System.out.println();
- //display both salaries
- System.out.printf("The yearly salary of %s is $%.2f\n",
- employee1.getFirstName(), employee1.getSalary() * 12);
- System.out.printf("The yearly salary of %s is $%.2f\n",
- employee2.getFirstName(), employee2.getSalary() * 12);
- //blank line
- System.out.println();
- //give both a 10% raise and display salary again
- employee1.setSalary(employee1.getSalary() * 1.10);
- employee2.setSalary(employee2.getSalary() * 1.10);
- System.out.printf("The yearly salary of %s is $%.2f\n",
- employee1.getFirstName(), employee1.getSalary() * 12);
- System.out.printf("The yearly salary of %s is $%.2f\n",
- employee2.getFirstName(), employee2.getSalary() * 12);
- }
- }
- /**
- Kyle
- Matt
- Bentley
- Smith
- The yearly salary of Matt is $60000.00
- The yearly salary of Dave is $102000.00
- The yearly salary of Matt is $66000.00
- The yearly salary of Dave is $112200.00
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement