daily pastebin goal
91%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Poll {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         int participants = Integer.parseInt(scanner.nextLine());
  9.         int votesForFirstPlace = Integer.parseInt(scanner.nextLine());
  10.  
  11.         double votesForSecondPlace = votesForFirstPlace - (votesForFirstPlace / 5);
  12.         double votesForThirdPlace = votesForSecondPlace -( votesForSecondPlace / 10);
  13.  
  14.         double allVotes = votesForFirstPlace + votesForSecondPlace + votesForThirdPlace;
  15.         double halfVotes = participants/2;
  16.  
  17.  
  18.  
  19.  
  20.         if(allVotes >= halfVotes){
  21.             double difference = Math.ceil(allVotes - halfVotes);
  22.             System.out.printf("First three languages have %d votes more", ((int)difference));
  23.  
  24.         }else {
  25.             double difference = Math.ceil(allVotes - halfVotes);
  26.             System.out.printf("First three languages have %d votes less of half votes", Math.abs((int)difference)) ;
  27.         }
  28.  
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top