Helena12

FootballSouvenirs

Nov 8th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.92 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FootballSouvenirs {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String team = scanner.nextLine();
  8.         String souvenirType = scanner.nextLine();
  9.         int souvenirsAmount = Integer.parseInt(scanner.nextLine());             // Брой закупени сувенири
  10.         double flag = 0;
  11.         double caps = 0;
  12.         double poster = 0;
  13.         double sticker = 0;
  14.         double totalAmount = 0;
  15.         if (team.equalsIgnoreCase("Argentina")) {
  16.             if (souvenirType.equalsIgnoreCase("flags")) {
  17.                 flag = 3.25;
  18.                 totalAmount = souvenirsAmount * flag;
  19.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  20.             } else if (souvenirType.equalsIgnoreCase("caps")) {
  21.                 caps = 7.20;
  22.                 totalAmount = souvenirsAmount * caps;
  23.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  24.             } else if (souvenirType.equalsIgnoreCase("posters")) {
  25.                 poster = 5.10;
  26.                 totalAmount = souvenirsAmount * poster;
  27.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  28.             } else {
  29.                 if (souvenirType.equalsIgnoreCase("stickers")) {
  30.                     sticker = 1.25;
  31.                     totalAmount = souvenirsAmount * sticker;
  32.                     System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  33.                 }
  34.             }
  35.         }
  36.  
  37.         if (team.equalsIgnoreCase("Brazil")) {
  38.             if (souvenirType.equalsIgnoreCase("flags")) {
  39.                 flag = 4.20;
  40.                 totalAmount = souvenirsAmount * flag;
  41.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  42.             } else if (souvenirType.equalsIgnoreCase("caps")) {
  43.                 caps = 8.50;
  44.                 totalAmount = souvenirsAmount * caps;
  45.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  46.             } else if (souvenirType.equalsIgnoreCase("posters")) {
  47.                 poster = 5.35;
  48.                 totalAmount = souvenirsAmount * poster;
  49.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  50.             } else {
  51.                 if (souvenirType.equalsIgnoreCase("stickers")) {
  52.                     sticker = 1.20;
  53.                     totalAmount = souvenirsAmount * sticker;
  54.                     System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  55.                 }
  56.             }
  57.         }
  58.  
  59.         if (team.equalsIgnoreCase("Croatia")) {
  60.             if (souvenirType.equalsIgnoreCase("flags")) {
  61.                 flag = 2.75;
  62.                 totalAmount = souvenirsAmount * flag;
  63.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  64.             } else if (souvenirType.equalsIgnoreCase("caps")) {
  65.                 caps = 6.90;
  66.                 totalAmount = souvenirsAmount * caps;
  67.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  68.             } else if (souvenirType.equalsIgnoreCase("posters")) {
  69.                 poster = 4.95;
  70.                 totalAmount = souvenirsAmount * poster;
  71.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  72.             } else {
  73.                 if (souvenirType.equalsIgnoreCase("stickers")) {
  74.                     sticker = 1.10;
  75.                     totalAmount = souvenirsAmount * sticker;
  76.                     System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  77.                 }
  78.             }
  79.         }
  80.  
  81.         if (team.equalsIgnoreCase("Denmark")) {
  82.             if (souvenirType.equalsIgnoreCase("flags")) {
  83.                 flag = 3.10;
  84.                 totalAmount = souvenirsAmount * flag;
  85.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  86.             } else if (souvenirType.equalsIgnoreCase("caps")) {
  87.                 caps = 6.50;
  88.                 totalAmount = souvenirsAmount * caps;
  89.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  90.             } else if (souvenirType.equalsIgnoreCase("posters")) {
  91.                 poster = 4.80;
  92.                 totalAmount = souvenirsAmount * poster;
  93.                 System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  94.             } else {
  95.                 if (souvenirType.equalsIgnoreCase("stickers")) {
  96.                     sticker = 0.90;
  97.                     totalAmount = souvenirsAmount * sticker;
  98.                     System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
  99.                 }
  100.             }
  101.         }
  102.  
  103.         if (!team.equalsIgnoreCase("Argentina") && !team.equalsIgnoreCase("Brazil")
  104.         && !team.equalsIgnoreCase("Croatia") && !team.equalsIgnoreCase("Denmark")) {
  105.             System.out.println("Invalid country!");
  106.         } else {
  107.             if (!souvenirType.equalsIgnoreCase("flags") && !souvenirType.equalsIgnoreCase("caps")
  108.                     && !souvenirType.equalsIgnoreCase("posters")
  109.                     && !souvenirType.equalsIgnoreCase("stickers")) {
  110.                 System.out.println("Invalid stock!");
  111.             }
  112.         }
  113.  
  114.     }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment