Kind of a beginner here trying to turn a while loop program into a do while loop. Basically if you couldn't tell the program generates a number form 1-10 and the user has 3 attempts to guess. For my class we have to write it in a while loop and a do while loop. I have been looking around on the basic differences of do while and while and I think I understand the concept except I am almost lost on how to change this code or what parts to add to the Do section. I assume its simple and I am just not thinking properly. Only thing I have done was add the Do to the program without any statements or conditions. If anyone could push me in the right direction or convert it for me that would be greatly appreciated.
Code
import java.util.*;
public class GuessNumberDoWhile {
public static void main (String[] args) {
//Generates random number between 1-10
int answer = (int) (Math.random()*10+1);
Scanner input = new Scanner(System.in);
System.out.print("Guess my secret number (Hint: it's between 1-10): ");
int guess = -1;
int count = 0;
//Do while loop
do{
}while (guess != answer){
guess = input.nextInt();
if (guess == answer)
System.out.println("Correct! You Win!");
else if (guess != answer)
System.out.println("Try Again");
count++;
if (count == 3 && guess != answer) {
System.out.println("My secret number: "+answer +", Better luck next time.");
break;
}
}
}
}![[Image: Nj4R0Bh.png]](https://i.imgur.com/Nj4R0Bh.png)

