Advertisement
Ivakis

Untitled

Mar 29th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4. * Created by User on 21.3.2017 г..
  5. */
  6. public class p02_SmallShop {
  7. public static void main(String[] args) {
  8. Scanner scanner = new Scanner(System.in);
  9.  
  10. String product = scanner.nextLine().toLowerCase();
  11. String city = scanner.nextLine().toLowerCase();
  12. double quantity = Double.parseDouble(scanner.nextLine());
  13.  
  14. if (city.equals("sofia")) {
  15. if (product.equals("coffee")) {
  16. System.out.println(quantity * 0.50);
  17. } else if (product.equals("water")) {
  18. System.out.println(quantity * 0.80);
  19. } else if (product.equals("beer")) {
  20. System.out.println(quantity * 1.20);
  21. } else if (product.equals("sweets")) {
  22. System.out.println(quantity * 1.45);
  23. } else if (product.equals("peanuts")) {
  24. System.out.println(quantity * 1.60);
  25. }
  26. }
  27. if (city.equals("plovdiv")) {
  28. if (product.equals("coffee")) {
  29. System.out.println(quantity * 0.40);
  30. } else if (product.equals("water")) {
  31. System.out.println(quantity * 0.70);
  32. } else if (product.equals("beer")) {
  33. System.out.println(quantity * 1.15);
  34. } else if (product.equals("sweets")) {
  35. System.out.println(quantity * 1.30);
  36. } else if (product.equals("peanuts")) {
  37. System.out.println(quantity * 1.50);
  38. }
  39. }
  40. if (city.equals("varna")) {
  41. if (product.equals("coffee")) {
  42. System.out.println(quantity * 0.45);
  43. } else if (product.equals("water")) {
  44. System.out.println(quantity * 0.70);
  45. } else if (product.equals("beer")) {
  46. System.out.println(quantity * 1.10);
  47. } else if (product.equals("sweets")) {
  48. System.out.println(quantity * 1.35);
  49. } else if (product.equals("peanuts")) {
  50. System.out.println(quantity * 1.55);
  51. }
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement