Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SmallShop {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. String product = scanner.nextLine().toLowerCase();
  10. String town = scanner.nextLine().toLowerCase();
  11. double quantity = Double.parseDouble(scanner.nextLine());
  12.  
  13. if (town.equals("sofia")) {
  14. if (product.equals("coffee")) {
  15. System.out.println(quantity * 0.5);
  16. } else if (product.equals("water")) {
  17. System.out.println(quantity * 0.8);
  18. } else if (product.equals("beer")) {
  19. System.out.println(quantity * 1.2);
  20. } else if (product.equals("sweets")) {
  21. System.out.println(quantity * 1.45);
  22. } else if (product.equals("peanuts")) {
  23. System.out.println(quantity * 1.6);
  24.  
  25.  
  26. } else if (town.equals("plovdiv")) {
  27. if (product.equals("coffee")) {
  28. System.out.println(quantity * 0.4);
  29. } else if (product.equals("water")) {
  30. System.out.println(quantity * 0.7);
  31. } else if (product.equals("beer")) {
  32. System.out.println(quantity * 1.15);
  33. } else if (product.equals("sweets")) {
  34. System.out.println(quantity * 1.3);
  35. } else if (product.equals("peanuts")) {
  36. System.out.println(quantity * 1.5);
  37.  
  38.  
  39. } else (town.equals("varna")) {
  40. if (product.equals("coffee")) {
  41. System.out.println(quantity * 0.45);
  42. } else if (product.equals("water")) {
  43. System.out.println(quantity * 0.7);
  44. } else if (product.equals("beer")) {
  45. System.out.println(quantity * 1.1);
  46. } else if (product.equals("sweets")) {
  47. System.out.println(quantity * 1.35);
  48. } else if (product.equals("peanuts")) {
  49. System.out.println(quantity * 1.55);
  50. }
  51. }
  52. }
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement