How can i make a loop that ask the user if they would like to buy more tickets and how can i make the random number generator make unique numbers. if you can help or show me website to find out how can i do this that will be great
Thank you
import java.util.Scanner;
import java.util.Arrays;
import java.util.Random;
public class PowerBallm {
  //declaring the main method
  public static void main(String[] args) 
  {
    //prompt user to enter amount of ticket to buy between 1 and 5
    System.out.print("How many tickets would you like to purchase ? ");  
    Scanner amount = new Scanner (System.in);
    double ticket_amount;
    ticket_amount = amount.nextInt();
    while (ticket_amount > 5 || ticket_amount <= 0)
    {
      System.out.println("You can only purchase up to FIVE tickets, please try again");
      while (!amount.hasNextInt())
      {
        amount.next();
      }
      ticket_amount = amount.nextInt();
    }
    //creating an Array of 5 numbers
    int group1[] = new int[5];
    for (int ticketNo = 0; ticketNo < ticket_amount; ticketNo++)
    {
      for(int i = 0; i < group1.length; i++)
      {
        group1[i] = 1 + (int) (Math.random() * 56);
      }     
      //sort the elements
      //Arrays.sort(group1);
      //group2 number 
      int group2 = 1 + (int) (Math.random()*46);
      //print the ticket numbers numbers
      System.out.println("Your group1 ticket numbers are " + Arrays.toString(group1) + " your group2 ticket number is " + group2);      
    }
  }
}
 
     
    