Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 23rd, 2013  |  syntax: None  |  size: 1.78 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public class EmployeeTest {
  2.  
  3.     public static void main(String[] args) {
  4.         Employee employee1 = new Employee("Kyle", "Bentley", 5000.00);
  5.         Employee employee2 = new Employee("Dave", "Skinner", 8500.00);
  6.  
  7.         //prints Kyle
  8.         System.out.println(employee1.getFirstName());
  9.  
  10.         //change employee1 name to Matt
  11.         employee1.setFirstName("Matt");
  12.         System.out.println(employee1.getFirstName());
  13.  
  14.         //blank line
  15.         System.out.println();
  16.  
  17.         //prints Bentley
  18.         System.out.println(employee1.getLastName());
  19.  
  20.         //change employee1 last name to Smith
  21.         employee1.setLastName("Smith");
  22.         System.out.println(employee1.getLastName());
  23.  
  24.         //blank line
  25.         System.out.println();
  26.  
  27.         //display both salaries
  28.         System.out.printf("The yearly salary of %s is $%.2f\n",
  29.                 employee1.getFirstName(), employee1.getSalary() * 12);
  30.         System.out.printf("The yearly salary of %s is $%.2f\n",
  31.                 employee2.getFirstName(), employee2.getSalary() * 12);
  32.  
  33.         //blank line
  34.         System.out.println();
  35.  
  36.         //give both a 10% raise and display salary again
  37.         employee1.setSalary(employee1.getSalary() * 1.10);
  38.         employee2.setSalary(employee2.getSalary() * 1.10);
  39.  
  40.         System.out.printf("The yearly salary of %s is $%.2f\n",
  41.                 employee1.getFirstName(), employee1.getSalary() * 12);
  42.         System.out.printf("The yearly salary of %s is $%.2f\n",
  43.                 employee2.getFirstName(), employee2.getSalary() * 12);
  44.     }
  45. }
  46.  
  47. /**
  48.  Kyle
  49.  Matt
  50.  
  51.  Bentley
  52.  Smith
  53.  
  54.  The yearly salary of Matt is $60000.00
  55.  The yearly salary of Dave is $102000.00
  56.  
  57.  The yearly salary of Matt is $66000.00
  58.  The yearly salary of Dave is $112200.00
  59.  */
clone this paste RAW Paste Data