Monday 15 October 2012

Programs to build 2

Programs to build 2

Guess the Number
Write a simple guess the number game, where you decided what the number was, saved it in the program and then the user had to guess it (The original version of the game meant that the game terminated after one guess)
Extension: The game keeps going until the user has guessed the number correctly
Extension 2: The user only gets 5 guesses
You will need: if statement, print, input, int, variables

Interest Calculator
Write a program which works out how much interest you have earnt over a certain number of years.
You have £300, the interest rate is 5% and you are keeping it in the account for 5 years.
The program should tell you how much interest you earn each year, and a total.
Extension: The user can input their own amount, interest rate and number of years
You will need: for loop, print, variables (Extension: input, float)

Guess the Number (v2)
Amend your Guess the Number game so that it runs until the person has guessed the answer correctly. The number they are trying to guess should be chosen at random by the computer.
Extension: The user only gets 5 guesses
You will need: while, break, random

Logging in
Write a program which allows a user to "log on" to your system. Your program should ask the user for their user name and password, and check them against a username and password already stored in the program.
If they type both in correctly, they should get a message which says "Welcome", if they type either one in wrong they should get a message which tells them to try again. They should then be given the option of trying again.
You will need: if statement, boolean expression, variables, input, print

No comments:

Post a Comment