Note that there are some explanatory texts on larger screens.

plurals
  1. PONot finding variable
    primarykey
    data
    text
    <p>I am having problems with my program compiling to find a variable. I have two classes for this program currently and my variable lotteryNumbers is in the first class. It is an int array variable though so I am not sure how to insert it in this line of code. This program is a lottery program to let people pick their tickets. Here is the lines of code where I get my first problem of not finding the variable</p> <pre><code>import java.util.Scanner; import java.util.InputMismatchException; public class CashBallTest { public static void main(String[]args) { Scanner keyboard = new Scanner(System.in); int kicker; System.out.println("\t\t\t\tCashLottoBall"); System.out.println("Player picks four numbers from 1 to 33 called LottoCash Balls. LottoCash Ball numbers must be unique from all other LottoCash Balls."); System.out.println(); System.out.println("The player must also pick a CashBall from 1 to 31."); System.out.println(); System.out.println("Kicker is a brand new feature you can purchase with your CashBall ticket which lets you get in on an extra drawing."); System.out.println(); System.out.println(); for(int index=0; index&lt;lotteryNumbers.length; index++) { </code></pre> <p>It is from the for(int..... line at the bottom.</p> <p>Edit* Here is the first class which is called CashBall and has the variable in it</p> <pre><code>import java.util.Scanner; public class CashBall { Scanner keyboard = new Scanner(System.in); int[] lotteryNumbers = new int[4]; int[] kicker = new int[4]; int[] kickerPowerBall = new int[1]; int yourNumbers; int CashBallPick; public CashBall(int yourNumbers, int CashBallPick) { this.yourNumbers=yourNumbers; this.CashBallPick=CashBallPick; } public int getYourNumbers() { return yourNumbers; } public int getCashBallPick() { return CashBallPick; } public void setYourNumbers(int yourNumbers) { this.yourNumbers=yourNumbers; } public void setCashBallPick(int CashBallPick) { this.CashBallPick=CashBallPick; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload