Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Use printf) with format specifiers as needed. Code on this page the following: Code an if statement that prints I've got to study!. The

image text in transcribedimage text in transcribedimage text in transcribed

3. Use printf) with format specifiers as needed. Code on this page the following: Code an if statement that prints "I've got to study!". The if condition tests the boolean variable upComingTest which is already declared a. if upComingTest) b. The prize money earned by a driver in the Daytona 500 depends upon their placement or position. Code an if-else statement that assigns $1,581,453 when the driver comes in 1st place; $1,157,470 when in 2nd place; and $857,245 when in 3rd place. Assume position and prizeMoney are already declared Make sure you scope the code properly. Code a conditional operator (ternary operator) that prints "I am going to the Bahamas!" when springVacation is true, and "Relaxing at home!" when it is false. Assume springVacation has already been declared and initialized. c. d. Code a while loop that keeps printing "Cowabunga Dude!" as long as the user enters 'Y' for the loop- control variable. Assume the loop-control variable, seeMovie,is already declared along with input for the Scanner class. The while loop requires a priming read for the loop-control variable before entering the loop. Create your own prompt for the loop-control variable. Code a while loop that determines and prints the winnings for the Daytona 500 depending upon the position after the finish-line: 15t, 2nd, or 3rd i. Assume the input variable for the Scanner class, position and prizeMoney variables are already e. declared ii. Declae noWinners variable, and initialize it to the number of winners. ii. Declare a counter-control variable for the while loop, and initialize it. iv. When the loop is entered, prompt: The driver crossed the finish line in which place? v. Insert the if-else structure from b into the while loop, and include code from vi. Print the following according to the position number where the $Z,ZZZ,ZZ9 is the amount of the prize money. The Z's suppress the printing of leading zeroes and the 9 denotes printing of any number from 0-9: 1st place: You're the first place winner and you get $Z,ZZZ,ZZ9! 2nd place: You're the second place winner and you get $Z,2zz,ZZ9! 3rd place: You're the third place winner and you get $Z ZZz,zz9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions