Advertisement
i_jaguar

Untitled

Feb 6th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Salary {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double salary = Double.parseDouble(scanner.nextLine());
  8. int t = Integer.parseInt(scanner.nextLine());
  9. String yOrN = scanner.nextLine();
  10. double sal = salary;
  11. double n = 0;
  12. double m = 0;
  13. double diff = 0;
  14.  
  15. if (salary >= 5000) {
  16. System.out.println("Current salary: 5000.00");
  17. System.out.println("0 more years to max salary.");
  18. } else {
  19.  
  20. for (int i = 1; i <= t; i++) {
  21. sal += sal * 0.06;
  22. if (yOrN.equalsIgnoreCase("Yes")) {
  23. sal -= sal * 0.01;
  24. } else if (yOrN.equalsIgnoreCase("No")) {
  25. sal=sal;
  26. }
  27. if (i%10==0) {
  28. sal += 200;
  29. }
  30. if (i%10==5) {
  31. sal += 100;
  32. }
  33. }
  34. if (sal<5000){
  35. System.out.printf("Current salary: %.2f\n", sal);
  36. }
  37. else {
  38. System.out.println("Current salary: 5000.00");
  39. }
  40.  
  41.  
  42. for (int i = t; i < 50; i++) {
  43.  
  44. if (sal >= 5000) {
  45. n=i-t;
  46. break;
  47. } else {
  48. sal += sal * 0.06;
  49. if (yOrN.equalsIgnoreCase("Yes")) {
  50. if (i%10!=0||i%10!=0){
  51. sal -= sal * 0.01;}
  52. } else if (yOrN.equalsIgnoreCase("No")) {
  53. sal=sal;
  54. }
  55.  
  56. if (i %10==0) {
  57. sal += 200;
  58. }
  59. if(i%10 == 5) {
  60. sal += 100;
  61. }
  62.  
  63.  
  64. }
  65. }
  66.  
  67. System.out.printf("%.0f more years to max salary.", n);
  68.  
  69.  
  70. }
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement