3️⃣

5.3 Practice

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.

πŸ’‘

UseΒ Math.PIΒ for a more accurate value of pi.

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.

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

πŸ’‘

Hint 1: Convert the amount of money to cents.

πŸ’‘

Hint 2: You might find the modulus operator to be useful.

🚨

This problem is challenging, but remember that you have everything you need to do it. If you get stuck, don’t worry! Keep working at it. If you still are having trouble, always feel free to reach out to your instructor.

βš–οΈ

Copyright Β© 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.