Chapter Table of Contents

Ch. 5 Scanner

Section Table of Contents

Practice

Circle Area

Create a program called CircleArea which prompts the user to enter the radius of a circle. Compute the area of the circle and display the result.

<aside> πŸ’‘ UseΒ Math.PIΒ for a more accurate value of pi.

</aside>

πŸ’» Template code

βœ… Solution code

Average

Create a program called Average where the user enters 3 numbers. (These numbers could be decimals or integers.) Compute and display the average of the 3 numbers.

πŸ’» Template code

βœ… Solution code

Change

The user enters an amount of money in standard format (for example, 11.56). Print the number of dollars, quarters, dimes, nickels, and pennies that makes up the given amount of money.

Example output:

Enter an amount of money (omit the $): 11.56
Your amount of $11.56 consists of
		11 dollars
		2 quarters
		0 dimes
		1 nickels
		1 pennies

<aside> πŸ’‘ Hint 1: Convert the amount of money to cents.

</aside>

<aside> πŸ’‘ Hint 2: You might find the modulus operator to be useful.

</aside>

πŸ’» Template code

βœ… Solution code