Question: What am i doing wrong here? its making me hit enter twice, im trying to loop this if they do not choose between 1-7 public

What am i doing wrong here? its making me hit enter twice, im trying to loop this if they do not choose between 1-7

public static int getNumber()

{

int totalCats = 7;

System.out.println("Enter the number of cats you want adopted: ");

totalCats = get.nextInt();

while(totalCats >= 7 )

{

System.out.println("We have a max of " + totalCats + " available for adoption" + " Please choose an amount between 1 and 7:");

totalCats = get.nextInt();

}

return totalCats;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!