Selection
from The Computing Zone
Write a program that asks the user if they would like some advice. If they enter Y, provide them with an amusing message.
Would you like some advice?
> Y
Always know where your towel is.
Would you like some advice?
> N
During a game of darts, the highest score that can be achieved in a single turn is 180. The lowest is 0. Write a program that will allow a dart player to enter their score. The program should congratulate the player if their score was over 100. If the player scores less than 10 they should be told that some practice is required.
Please enter your score:
> 125
What a great score! Well done.
Please enter your score:
> 7
That was rubbish. Get practising!
Three friends have been collecting money for charity. A local company has offered to double the amount of money they collect if they raise over $1000. Write a program that allows the friends to enter their individual amounts. The program should then add the three amounts and store the total. If the total is greater or equal to $1000 the total should be doubled. Finally the total should be displayed.
Enter the first amount raised.
> 398
Enter the second amount raised.
> 193
Enter the third amount raised.
> 478
A total of $1069 was raised.
This will be doubled to $2138.
At normal atmospheric pressure, water is a solid at or below 0°C, a gas above 100°C, and a liquid in the middle. Write a program that will return solid, liquid or gas to the user depending on the temperature they enter.
Enter the current temperature.
> 78
At 78°C, water will be a liquid.