I'm creating a lottery program and trying linked lists for the first time. I'm passing the numbers array from the Player class to the Lottery class so that I can display the current players Numbers, but it keeps giving me the error "actual and formal parameters differ in length"
.
There will be another class which will be made for the winning numbers but I'm trying to fix this issue first. I'm unsure how to fix this as I've been stuck for quite a while now.
Any help would be much appreciated.
This is the piece of code I'm having trouble with, this is in the Lottery class in the displayPlayers() method
-
for(int i = 0; i < 6; i++) {
System.out.println(currentPlayer.getNumbers(i));
}
public class LOTTERY
{
Scanner keyboard = new Scanner(System.in);
private PLAYER pHead;
public LOTTERY()
{
pHead = null;
}
public void displayPlayers() {
PLAYER currentPlayer = pHead;
System.out.println("Name: " + currentPlayer.getName());
System.out.println("Age: " + currentPlayer.getAge());
currentPlayer.randNum();
System.out.println("Your Numbers: ");
for(int i = 0; i < 6; i++) {
System.out.println(currentPlayer.getNumbers(i));
}
menu();
}
public void runProg() {
displayPlayers();
}
public static void main(String[] args) {
LOTTERY lottery = new LOTTERY();
lottery.runProg();
}
}