NLKappa

CЛОЖНА БЛЕТ ШТОТО СДЕЛОЛ 07.10 ДЗ

Oct 7th, 2017
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.     public static boolean selection (boolean x, boolean y, boolean z) {
  7.         int a = 0;
  8.         if (x == true) {
  9.             a += 1;
  10.         }
  11.         if (y == true) {
  12.             a += 1;
  13.         }
  14.         if (z == true) {
  15.             a += 1;
  16.         }
  17.         if (a >= 2) {
  18.             System.out.println("Большинство голосов TRUE.");
  19.         } else {
  20.             System.out.println("Большинство голосов FALSE.");
  21.         }
  22.         return false;
  23.     }
  24.  
  25.     public static void main(String[] args) {
  26.         Scanner sc = new Scanner(System.in);
  27.         System.out.println("Введите три голоса TRUE и FALSE: ");
  28.         selection(sc.nextBoolean(),sc.nextBoolean(),sc.nextBoolean());
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment