jeudi 12 mars 2015

Java Program array and if statements [duplicate]




This question already has an answer here:




So I have a piece of code and it's mostly done but I cannot get this last part. What it is suppose to do is ask the user do you want to shuffle the deck and if the user types Yes or Y it shuffles the deck and if the user says no it ends the program. heres my piece of code




System.out.println("Here are the numbers:");
for (i=0; i<numberArray.length; i++) {
System.out.print(numberArray[i] + " " );
}
while (x != scan.nextInt()){

System.out.printf("Do you wish to shuffle these numbers ");
String shiftTimes= scan.nextLine();
if (shiftTimes == "yes"){

shuffle.Shuffle(numberArray);

for(j = 0; j < numberArray.length; j++)
System.out.printf(numberArray[j]+" ");
if ( shiftTimes =="no"){
System.exit(0) ;
}
}


if any other piece of my code is needed please ask




Aucun commentaire:

Enregistrer un commentaire