Chapter Table of Contents
Ch. 5 ScannerSection 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.π» Template 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
Β
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.
π» Template code
Β
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.
Β
Previous Section
5.2 Different Types of InputNext Section
Chapter 5 QuizΒ
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.
Β