Advertisement
Guest User

Buns

a guest
Sep 27th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. System.out.println("Please enter your starting salary: ");
  2. double sal = in.nextInt();
  3.  
  4. while(sal <= 0)
  5. {
  6. System.out.println("You cannot have a $0 or less salary. Please enter again: ");
  7. sal = in.nextInt();
  8. }
  9.  
  10. //inputs and error checks
  11. System.out.println("Please enter your yearly percent increase: ");
  12. double per = in.nextInt();
  13. per = per / 100;
  14.  
  15. while(per <= 0)
  16. {
  17. System.out.println("Your raise percent cannot be $0 or less. Please enter again: ");
  18. per = in.nextInt();
  19. per = per / 100;
  20. }
  21.  
  22. //inputs and error checks
  23. System.out.println("Please enter the number of years worked: ");
  24. int year = in.nextInt();
  25.  
  26. while(year <= 0)
  27. {
  28. System.out.println("You have to have worked for at least a year. Please enter again: ");
  29. year = in.nextInt();
  30. }
  31.  
  32. //calculations and output
  33. for(int i=1; i<=year; i++)
  34. {
  35. while(i <= 9)
  36. {
  37. double salaryinc = per * sal;
  38. sal = (double)(Math.round(sal * 100)) / 100;
  39. System.out.println("");
  40. System.out.println("Year: " + i);
  41. System.out.println("Salary: " + sal);
  42. sal = sal + salaryinc;
  43. i++;
  44. }
  45. sal = (double)(Math.round(sal * 100)) / 100;
  46. System.out.println("");
  47. System.out.println("Salary: " + i);
  48. System.out.println("Salary: " + sal);
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement