Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class FootballSouvenirs {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String team = scanner.nextLine();
- String souvenirType = scanner.nextLine();
- int souvenirsAmount = Integer.parseInt(scanner.nextLine()); // Брой закупени сувенири
- double flag = 0;
- double caps = 0;
- double poster = 0;
- double sticker = 0;
- double totalAmount = 0;
- if (team.equalsIgnoreCase("Argentina")) {
- if (souvenirType.equalsIgnoreCase("flags")) {
- flag = 3.25;
- totalAmount = souvenirsAmount * flag;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else if (souvenirType.equalsIgnoreCase("caps")) {
- caps = 7.20;
- totalAmount = souvenirsAmount * caps;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else if (souvenirType.equalsIgnoreCase("posters")) {
- poster = 5.10;
- totalAmount = souvenirsAmount * poster;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else {
- if (souvenirType.equalsIgnoreCase("stickers")) {
- sticker = 1.25;
- totalAmount = souvenirsAmount * sticker;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- }
- }
- }
- if (team.equalsIgnoreCase("Brazil")) {
- if (souvenirType.equalsIgnoreCase("flags")) {
- flag = 4.20;
- totalAmount = souvenirsAmount * flag;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else if (souvenirType.equalsIgnoreCase("caps")) {
- caps = 8.50;
- totalAmount = souvenirsAmount * caps;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else if (souvenirType.equalsIgnoreCase("posters")) {
- poster = 5.35;
- totalAmount = souvenirsAmount * poster;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else {
- if (souvenirType.equalsIgnoreCase("stickers")) {
- sticker = 1.20;
- totalAmount = souvenirsAmount * sticker;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- }
- }
- }
- if (team.equalsIgnoreCase("Croatia")) {
- if (souvenirType.equalsIgnoreCase("flags")) {
- flag = 2.75;
- totalAmount = souvenirsAmount * flag;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else if (souvenirType.equalsIgnoreCase("caps")) {
- caps = 6.90;
- totalAmount = souvenirsAmount * caps;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else if (souvenirType.equalsIgnoreCase("posters")) {
- poster = 4.95;
- totalAmount = souvenirsAmount * poster;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else {
- if (souvenirType.equalsIgnoreCase("stickers")) {
- sticker = 1.10;
- totalAmount = souvenirsAmount * sticker;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- }
- }
- }
- if (team.equalsIgnoreCase("Denmark")) {
- if (souvenirType.equalsIgnoreCase("flags")) {
- flag = 3.10;
- totalAmount = souvenirsAmount * flag;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else if (souvenirType.equalsIgnoreCase("caps")) {
- caps = 6.50;
- totalAmount = souvenirsAmount * caps;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else if (souvenirType.equalsIgnoreCase("posters")) {
- poster = 4.80;
- totalAmount = souvenirsAmount * poster;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- } else {
- if (souvenirType.equalsIgnoreCase("stickers")) {
- sticker = 0.90;
- totalAmount = souvenirsAmount * sticker;
- System.out.printf("Pepi bought %d %s of %s for %.2f lv.", souvenirsAmount, souvenirType, team, totalAmount);
- }
- }
- }
- if (!team.equalsIgnoreCase("Argentina") && !team.equalsIgnoreCase("Brazil")
- && !team.equalsIgnoreCase("Croatia") && !team.equalsIgnoreCase("Denmark")) {
- System.out.println("Invalid country!");
- } else {
- if (!souvenirType.equalsIgnoreCase("flags") && !souvenirType.equalsIgnoreCase("caps")
- && !souvenirType.equalsIgnoreCase("posters")
- && !souvenirType.equalsIgnoreCase("stickers")) {
- System.out.println("Invalid stock!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment