for now I plan to regenerate player and draw numbers each time so its like a new game every time. However once I get that to work I am going to try adding switches.
my code looks like this so far
import java.util.*;
public class newprogram{
public static void main (String[] args){
boolean done = false;
boolean playagain = true;
int rand1, rand2, rand3, rand4, yours1, yours2, yours3, yours4;
Random numberGenerator = new Random();
Scanner scan = new Scanner(System.in);
final String playmessage = "Would l you like to play the lotto? (y / n)";
final String youlost = "Sorry you did not win, buy another ticket?";
final String youwin = "you won the lotto, go quit your job!!!";
System.out.println(playmessage);
if (scan.next().equals("n"))
playagain = false;
else
done = false;
rand1 = numberGenerator.nextInt(9);
rand2 = numberGenerator.nextInt(9);
rand3 = numberGenerator.nextInt(9);
rand4 = numberGenerator.nextInt(9);
yours1 = numberGenerator.nextInt(9);
yours2 = numberGenerator.nextInt(9);
yours3 = numberGenerator.nextInt(9);
yours4 = numberGenerator.nextInt(9);
System.out.println ("The winning Lotto numbers are: " + rand1 +rand2 + rand3 + rand4);
System.out.println ("Your numbers cam up: " + yours1 + yours2 + yours3 + yours4);
while (playagain){
if (rand1 == yours1)
done = true;
else if (rand2 == yours2)
done = true;
else if (rand3 == yours3)
done = true;
else if (rand4 == yours4)
done = true;
else
done = false;
}
while (done = false)
System.out.println(youlost);
}
}
what I plan on doing is just make both generators to draw until the numbers match.
and sorry for the lack of info, however I do plan on doing this myself, i am just so new that i think I need to be pointed in a new direction.
also I have never done a for loop and don't understand it very well thats why I am asking.....not to get someone else to do work for me, sorry if I came across that way.
thank you for your reply