Question: Repetition Structures 1. Code a do-while loop that keeps printing the message THE DOG IS RUNNING IN CIRCLES! as long as the dog is chasing

Repetition Structures

1. Code a do-while loop that keeps printing the message "THE DOG IS RUNNING IN CIRCLES!" as long as the dog is chasing its tail. Assume chaseTail and input (for the Scanner class) are already declared. Prompt for the loop-control variable.

2. Re-code 1b using a while loop. Prime chaseTail so the loop is entered the first time.

3. Code a for loop with the Olympic Sport switch structure from the IC Ch. 3: if, ifElse, switch, Logical Operators - Nongradable exercise. Allow 3 attempts. Prompt the user to enter an Olympic sport where 1 is Women's Gymnastics, 2 is Girl's Volley-Ball, 3 is Men's Swimming, 4 is Bobsled, 5 is Alpine Skiing, and 6 is Biathlon. When the number entered is in the correct range make sure you exit the loop (not the program) after the message for the range is printed. Print the message "No more attempts left!" if it is the last attempt for an invalid entry.

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!