I would like for you to create the following projects to bring in on Monday/Tuesday class:
- Create a Class called CoinToss
- Add appropriate comments, titles and attributions
- Display a title "text graphic" when the program is executed
- Ask the user to choose "heads or tails"
- Generate a random number (using either of the methods that I showed you)
- Display the going as a "text graphic" (either heads or tails)
- Tell the user whether they win or lose
Create a simple menu program which allows users to run different routines:
- Create a new Class
- Add appropriate comments, titles and attributions
- Display a title "text graphic" when the program is executed
- Display a menu of at least 4 items
- Have user input a menu choice (i.e. 1 - 4)
- If the user did not enter a valid menu choice give them an error message and end program.
- For each of the menu choices, do something different (i.e. one can generate a random horoscope, one can ask the user for two numbers to multiple, what can calculate the square feet in a room, etc.)
We will take some time to demo a few in class before we get started.
Fewest
Coins Possible: The idea for this project is that we ask the user for
the amount of change they have (let's assume it's $1 or less) and we
figure out the fewest number of coins needed to total that amount. Now
if you remember from the "Equally Divide" project we calculated a
remainder as "Left Over" -- and this is similar to that. We will
calculate the number of quarters needed, get the remainder, divide that
by the number of dimes, etc.
♦ Set up variables for each coin type: Quarters, Dimes, Nickels, and Pennies
♦ Set up a variable for the currentCents
♦ Ask users to enter the amount of cents ($1 would be 100, for example)
♦ Calculate Quarters first, then find the remainder and set currentCents to the remainder amount
♦ Calculate Dimes from the remainder (again currentCents)
♦ Continue with Nickels and Pennies
♦ Display the results like, "Quarters: xx"
♦ Amounts to try: 91, 41, 59, 6 (and obviously others)
This program is definitely possible for you to complete knowing what you already know.
No comments:
Post a Comment