I made a coin toss program and it shows me the number of heads and tails that are generated by the program. My question is how do I get the program to show me just the percentage of heads and tails that are generated?
import javax.swing.JOptionPane; public class Flip { public static void main(String args[]) { int heads= 0; int tails= 0; for(int i=0;i<26;i++){ double outcome =Math.random(); if(outcome >= 0.5) heads++; else if (outcome < 0.5) tails++; } JOptionPane.showMessageDialog(null, "Heads"+" "+heads); JOptionPane.showMessageDialog(null, "Tails"+" "+tails); } }