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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started