Vlad5080

hw\copy\2

Aug 11th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. //
  2. // Source code recreated from a .class file by IntelliJ IDEA
  3. // (powered by FernFlower decompiler)
  4. //
  5.  
  6. import java.util.Scanner;
  7.  
  8. public class Main {
  9.     public Main() {
  10.     }
  11.  
  12.     public static void main(String[] args) {
  13.         Scanner scanner = new Scanner(System.in);
  14.         String[] products = new String[]{"Хлеб", "Яблоки", "Молоко"};
  15.         int[] var10000 = new int[]{100, 200, 300};
  16.         System.out.println("Список возможных товаров для покупки: ");
  17.  
  18.         int productNumber;
  19.         for(productNumber = 0; productNumber < 3; ++productNumber) {
  20.             System.out.print(productNumber + 1 + ". " + products[productNumber] + "\n");
  21.         }
  22.  
  23.         productNumber = 0;
  24.         int productCount = 0;
  25.         System.out.println("\nВыберите товар и количество или введите `end`");
  26.  
  27.         String[] item;
  28.         for(String input = scanner.nextLine(); input.equals("end"); productCount = Math.abs(Integer.parseInt(item[1]))) {
  29.             System.out.println("\nВыберите товар и количество или введите `end`");
  30.             input = scanner.nextLine();
  31.             item = input.split(" ");
  32.             productNumber = Integer.parseInt(item[0]) - 1;
  33.         }
  34.  
  35.         System.out.println(productNumber);
  36.         System.out.println(productCount);
  37.     }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment