Advertisement
Guest User

Untitled

a guest
Nov 15th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.63 KB | None | 0 0
  1.         System.out.println("Хотите ли вы задать имена? \nВведите 0 - чтоб отказаться\n");
  2.         boolean bll = true;
  3.         if (sc.nextInt() == 0) {
  4.             while (bll) {
  5.                 do {
  6.                     System.out.print("a=");
  7.                     a = sc.nextDouble();
  8.                     if (a == 0) {
  9.                         bll = false;
  10.                         break;
  11.                     }
  12.                     System.out.print("b=");
  13.                     b = sc.nextDouble();
  14.                     if (b == 0) {
  15.                         bll = false;
  16.                         break;
  17.                     }
  18.                     System.out.print("c=");
  19.                     c = sc.nextDouble();
  20.                     if (c == 0) {
  21.                         bll = false;
  22.                         break;
  23.                     }
  24.                     if (Triangle.test(a, b, c)) {
  25.                         System.out.println();
  26.                         System.out.println("Данного треугольника не существует! Повторите ввод.");
  27.                     }
  28.                 } while (Triangle.test(a, b, c));
  29.                 if (!bll) {
  30.                     break;
  31.                 }
  32.                 list.add(new Triangle(a, b, c));
  33.             }
  34.         } else {
  35.             while (bll) {
  36.                 do {
  37.                     System.out.print("a=");
  38.                     a = sc.nextDouble();
  39.                     if (a == 0) {
  40.                         bll = false;
  41.                         break;
  42.                     }
  43.                     System.out.print("b=");
  44.                     b = sc.nextDouble();
  45.                     if (b == 0) {
  46.                         bll = false;
  47.                         break;
  48.                     }
  49.                     System.out.print("c=");
  50.                     c = sc.nextDouble();
  51.                     if (c == 0) {
  52.                         bll = false;
  53.                         break;
  54.                     }
  55.                     if (Triangle.test(a, b, c)) {
  56.                         System.out.println();
  57.                         System.out.println("Данного треугольника не существует! Повторите ввод.");
  58.                     }
  59.  
  60.                 } while (Triangle.test(a, b, c));
  61.                 if (!bll) {
  62.                     break;
  63.                 }
  64.                 System.out.println("\nТеперь введите имя.");
  65.                 s=sc.nextLine();
  66.                 list.add(new Triangle(a, b, c));
  67.                 list.get(list.size()-1).nameIt(s);
  68.             }
  69.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement