Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static boolean selection (boolean x, boolean y, boolean z) {
- int a = 0;
- if (x == true) {
- a += 1;
- }
- if (y == true) {
- a += 1;
- }
- if (z == true) {
- a += 1;
- }
- if (a >= 2) {
- System.out.println("Большинство голосов TRUE.");
- } else {
- System.out.println("Большинство голосов FALSE.");
- }
- return false;
- }
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Введите три голоса TRUE и FALSE: ");
- selection(sc.nextBoolean(),sc.nextBoolean(),sc.nextBoolean());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment