public class n_coinflips { public static void main(String[] args) { int flips = Integer.parseInt(args[0]); int person = Integer.parseInt(args[0]); double worst_ratio =1; int worst_person =0; for (int j =1; j<= person; j++){ int heads = 0; for (int i =0; i < flips; i++) { double flip = 0; flip = Math.random(); if (flip >= 0.5) { heads++; //System.out.println(heads); } } System.out.println("person " + j + ": "+(double)(heads) / flips); if (((double)(heads) / flips) <= worst_ratio){ worst_ratio = (double)(heads) / flips; worst_person =j; } } System.out.println("congratulations, person " + worst_person + " you have the worst ratio today: " + worst_ratio ); } }