Advertisement
desislava_topuzakova

03.Mobile Operator

Mar 9th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class Test {
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7.  
  8. String DurationOfContract = scanner.nextLine();
  9. String TypeOfContract = scanner.nextLine();
  10. String AddedInternet = scanner.nextLine();
  11. int PayingMonths = Integer.parseInt(scanner.nextLine());
  12.  
  13. double price = 0;
  14.  
  15. if (DurationOfContract.equals("one")) {
  16. if (TypeOfContract.equals("Small")) {
  17. if (AddedInternet.equals("yes")) {
  18. price = (9.98 + 5.50) * PayingMonths;
  19. System.out.printf("%.2f lv.%n", price);
  20. } else if (AddedInternet.equals("no")) {
  21. price = 9.98 * PayingMonths;
  22. System.out.printf("%.2f lv.%n", price);
  23. }
  24. } else if (TypeOfContract.equals("Middle")) {
  25. if (AddedInternet.equals("yes")) {
  26. price = (18.99 + 4.35) * PayingMonths;
  27. System.out.printf("%.2f lv.%n", price);
  28. } else if (AddedInternet.equals("no")) {
  29. price = 18.99 * PayingMonths;
  30. System.out.printf("%.2f lv.%n", price);
  31. }
  32. } else if (TypeOfContract.equals("Large")) {
  33. if (AddedInternet.equals("yes")) {
  34. price = (25.98 + 4.35) * PayingMonths;
  35. System.out.printf("%.2f lv.%n", price);
  36. } else if (AddedInternet.equals("no")) {
  37. price = 25.98 * PayingMonths;
  38. System.out.printf("%.2f lv.%n", price);
  39. }
  40. } else if (TypeOfContract.equals("ExtraLarge")) {
  41. if (AddedInternet.equals("yes")) {
  42. price = (35.99 + 3.85) * PayingMonths;
  43. System.out.printf("%.2f lv.%n", price);
  44. } else if (AddedInternet.equals("no")) {
  45. price = 35.99 * PayingMonths;
  46. System.out.printf("%.2f lv.%n", price);
  47. }
  48. }
  49. }
  50. if (DurationOfContract.equals("two")) {
  51. if (TypeOfContract.equals("Small")) {
  52. if (AddedInternet.equals("yes")) {
  53. price = (8.58 + 5.50) * PayingMonths;
  54. price = price - price * 0.0375;
  55. System.out.printf("%.2f lv.%n", price);
  56. } else if (AddedInternet.equals("no")) {
  57. price = 8.58 * PayingMonths;
  58. price = price - price * 0.0375;
  59. System.out.printf("%.2f lv.%n", price);
  60. }
  61. } else if (TypeOfContract.equals("Middle")) {
  62. if (AddedInternet.equals("yes")) {
  63. price = (17.09 + 4.35) * PayingMonths;
  64. price = price - price * 0.0375;
  65. System.out.printf("%.2f lv.%n", price);
  66. } else if (AddedInternet.equals("no")) {
  67. price = 17.09 * PayingMonths;
  68. price = price - price * 0.0375;
  69. System.out.printf("%.2f lv.%n", price);
  70. }
  71.  
  72. } else if (TypeOfContract.equals("Large")) {
  73. if (AddedInternet.equals("yes")) {
  74. price = (23.59 + 4.35) * PayingMonths;
  75. price = price - price * 0.0375;
  76. System.out.printf("%.2f lv.%n", price);
  77. } else if (AddedInternet.equals("no")) {
  78. price = 23.59 * PayingMonths;
  79. price = price - price * 0.0375;
  80. System.out.printf("%.2f lv.%n", price);
  81. }
  82. } else if (TypeOfContract.equals("ExtraLarge")) {
  83. if (AddedInternet.equals("yes")) {
  84. price = (31.79 + 3.85) * PayingMonths;
  85. price = price - price * 0.0375;
  86. System.out.printf("%.2f lv.%n", price);
  87. } else if (AddedInternet.equals("no")) {
  88. price = 31.79 * PayingMonths;
  89. price = price - price * 0.0375;
  90. System.out.printf("%.2f lv.%n", price);
  91. }
  92. }
  93. }
  94. }
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement