Advertisement
Ivakis

Mobile Operator

Oct 10th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String period = scanner.nextLine();
  8. String type = scanner.nextLine();
  9. String internet = scanner.nextLine();
  10. int months = Integer.parseInt(scanner.nextLine());
  11.  
  12. double price = 0;
  13.  
  14. if(period.equals("one")){
  15. if(type.equals("Small")){
  16. price = 9.98;
  17. }else if(type.equals("Middle")){
  18. price = 18.99;
  19. }else if(type.equals("Large")){
  20. price = 25.98;
  21. }else if(type.equals("ExtraLarge")){
  22. price = 35.99;
  23. }
  24. }else{
  25. if(type.equals("Small")){
  26. price = 8.58;
  27. }else if(type.equals("Middle")){
  28. price = 17.09;
  29. }else if(type.equals("Large")){
  30. price = 23.59;
  31. }else if(type.equals("ExtraLarge")){
  32. price = 31.79;
  33. }
  34. }
  35. if(internet.equals("yes")){
  36. if(price <= 10){
  37. price += 5.50;
  38. }else if(price <= 30){
  39. price += 4.35;
  40. }else{
  41. price += 3.85;
  42. }
  43. }
  44. if(period.equals("two")){
  45. price = price - (price * 0.0375);
  46. }
  47.  
  48. double totalPrice = price * months;
  49.  
  50. System.out.printf("%.2f lv.", totalPrice);
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement