Assignment:
Q: Design and write an Applet program in Java to simulate the operation of a car park pre-payment machine. The machine should allow the customer to select how many hours they require to park, accept payment in the following denominations: 10p, 20p, 50p, £1, and £2, and display the amount of any change due.
The charges are as follows:
Hours Amount payable
0-1 £1.00
1-2 £2.00
2-3 £3.50
3-4 £5.00
4+ £6.00
The program should:
1. Allow the customer to select the number of hours car parking to be purchased by pressing a button
2. Display the amount payable in a text box
3. Accept payment from the customer via button press until the full payment is received
4. A suitable 'thank you' message should be displayed if the payment is correct
5. If the payment is too much, the change due should be displayed
At startup, note that the hours buttons are enabled, while the payment buttons are not. Once a time has been selected, the payment buttons should automatically enable and the hour buttons should disable.