Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

Students also viewed these Databases questions

Question

Prepare and properly label figures and tables for written reports.

Answered: 1 week ago