As part of my homework I have been given an already prepared public static void main method. My job is to supplement this by creating all the methods relevant for this. This should be done in three other classes.
In the already prepared main method, there is the following code:
ticket = new LotteryTicket(10);
ticket.ticketOwner = new Player();
LotteryTicket
and Player
are other classes created by me. Relevant instance variables in the LotteryTicket
class are:
private LotteryRow[] rows;
private Player ticketOwner;
public LotteryTicket(int maxNumberOfRows) {
this.rows = new LotteryRow[maxNumberOfRows];
}
Player
is, as mentioned, another class I have created. In this class there is, among other things, a method for the user to input data such as name, address, postal code, etc.
When I try to run the program, I get an error in the ticket.ticketOwner = new Player();
line. The error is: "The field LotteryTicket.ticketOwner
is not visible"
What can be the cause of this? I would greatly appreciate any help! I hope the code I have provided is sufficient. I have not encountered this error message before, so I am at a loss about what to do.