Int Userturn Int Cnt Scanner Input New Scanner System In Int Temp 0 Do System Ou
int userTurn(int cnt){Scanner input = new Scanner(System.in);int temp=0;do{System.out.println(“There are ” + cnt + ” stones in the pile.”);System.out.print(“How many stones would you like to remove?(1, 2, or 3) “);temp = input.nextInt();if (temp 3) // 1, 2, or 3 stones can be removed only{System.out.println(“Please enter 1, 2, or 3.”);continue;}if (temp > cnt){System.out.println(“You cannot remove more stones than there are in the pile.”);continue;}break; // a valid # was entered} while (true);return temp;} // userTurn
The desired control flow graph is as given below: The desired Static data flow testing graph is as given below:
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
