//Hello(apologize for any formatting errors)
//I am trying to finish this program that is supposed to act as a club bouncer. Only letting a max amount of people (125) in at one time. Naturally people leave throughout the night, so I was trying to //implement that with the random variable, but it keeps producing negative values. Any help would be greatly appreciated.
import java.util.Random;
import javax.swing.JOptionPane;
public class Clubmanger
{
public static void main(String[] args)
{
int counter = 0;
Random leaving=new Random();
do
{
int addperson=Integer.parseInt(JOptionPane.showInputDialog("Welcome to Club G, how many people in your party?"));
if(addperson+counter>125)
{
JOptionPane.showMessageDialog(null,"There are too many people inside the club to allow you entry, please try again later");
System.exit(0);
}
else
{
counter=+addperson;
JOptionPane.showMessageDialog(null,"There are currently: "+counter+" people inside.");
}
int personleaving=leaving.nextInt(counter)+1;
counter=-personleaving;
JOptionPane.showMessageDialog(null,"There are:"+counter+"inside the club.");
}while(counter<=124);
}
}