Programming Exercise

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Programming Exercise (28th June 2012) 1. You just opened a cyber-caf.

In order to compete with your competitors, you have to come up with an interesting scheme to attract more customers. Instead of making your customers pay the same rate for each hour they use your computer, you would like to make them pay less the longer they use your computer. You came up with this scheme: First one hour: RM 1.20 Subsequent hours: RM 0.80 Write a program to help you calculate the amount of money that your customers have to pay depending on how long they have used your computer (in hours). Sample output: Enter the number of hours: 4 Amount you have to pay is: First one hour: 1 x RM 1.20 Subsequent hours: 3 x RM 0.80 Total is RM 3.60 Number of pamphlets : 100 Basic Pay : RM50.00 Commission : RM 2.50 Gross Pay : RM52.50 2. Write a program for a printing company which pays workers for delivering pamphlets into the neighbourhood. The workers are paid for the number of pamphlets delivered, plus a commission. The charges are as follows: Basic pay is calculated based on the number of pamphlet. Price per pamphlet is 50 cents. A commission is 5% of the basic pay.

Calculate the basic pay; then add in the commission to give the gross pay and display the gross pay amount. Sample output:

You might also like