GAD225: HW 1
Wednesday, October 8th, 2008The first two should be solveable immediately, but the last 3 will require some stuff from week 2, so you'll have to either read ahead, or wait until next week to started on them.
- Write a program that uses a series of outputs to display ASCII art. Be creative. Your program's output should be better looking than my "Face" program!
- Write a program that prints out a traces out a series of lines that explains how to calculate the following 5 geometric result: area of a rectangle, perimeter of a rectangle, area of a triangle, area of a circle (you can use Math.PI for pi!), and circumference of a circle. Trace out both an equation showing how it is calculated, and an example calculation, for each one.
-
Generate three random numbers, for the following three variables: balance (Number), interestRate(Number), and minimumBalance (int).
balance should be some number between 0 and 10,000.
interestRate should be some number between 0 and 0.1
minimumBalance should be some int multiple of 100, between 0 and 5,000If the balance is less than minimumBalance, charge the user a $100 fee.
If the balance is at least twice the minimumBalance, double the interestRate.
Apply the interest rate to the balance. - Make a random number generator that simulates rolling 3 (6 sided) dice. Roll them once to determine your base number, and then print it out. Then roll them as many times as it takes to hit that base number again, printing out the total number of rolls. Also print out how many times you rolled higher than the base number, and how many times you rolled lower than your base number. NOTE: Matching your base number just means having the same total. I don't care what the actual dice show. A 12 is a 12.
- Let's make a dice check game. Rolling 3 6 sided dice again, let's roll until we have successfully rolled each possible result (3-18) at least once. Once this has happened, print out the total number of times each result showed up, as well as what percentage of the time each result showed up.