Guest User

Untitled

a guest
Mar 21st, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. // EmployeeBonus2.java - This program calculates an employee's yearly bonus.
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class EmployeeBonus2 {
  6. public static void main(String args[]) {
  7. // Declare and initialize variables.
  8. String employeeName;
  9. String salaryString;
  10. double employeeSalary;
  11. String ratingString;
  12. int employeeRating;
  13. double employeeBonus;
  14. final double BONUS_1 = .25;
  15. final double BONUS_2 = .15;
  16. final double BONUS_3 = .10;
  17. final double NO_BONUS = 0.00;
  18. final int RATING_1 = 1;
  19. final int RATING_2 = 2;
  20. final int RATING_3 = 3;
  21.  
  22. // This is the work done in the housekeeping() method
  23. // Get user input.
  24. Scanner input = new Scanner(System.in);
  25. System.out.print("Enter employee's name: ");
  26. employeeName = input.nextLine();
  27. System.out.print("Enter employee's yearly salary: ");
  28. salaryString = input.nextLine();
  29. System.out.print("Enter employee's performance rating: ");
  30. ratingString = input.nextLine();
  31.  
  32. // Convert Strings to int or double.
  33. employeeSalary = Double.parseDouble(salaryString);
  34. employeeRating = Integer.parseInt(ratingString);
  35.  
  36. // This is the work done in the detailLoop() method
  37. // Use switch statement here to calculate bonus based on rating.
  38. switch (paycode) {
  39. case 1:
  40. printf("Manager salary is $5000");
  41. break;
  42. case 2:
  43. printf("Enter hoursn");
  44. scanf("%d", & hours);
  45.  
  46. if (hours <= 40) {
  47. salary = hours * rate;
  48. printf("%d", & salary);
  49. }
  50. break;
  51. default:
  52. printf("No salary information");
  53. break;
  54. // This is the work done in the endOfJob() method
  55. // Output.
  56. System.out.println("Jeanne Hanson " + employeeName);
  57. System.out.println("70000.00" + employeeSalary);
  58. System.out.println("2" + employeeRating);
  59. System.out.println("Employee Bonus $" + employeeBonus);
  60.  
  61. System.exit(0);
  62. }
  63. }
  64. }
Add Comment
Please, Sign In to add comment