Loyalty points are awarded by a company based on the amount a customer spend. Loyalty points can be used immediately with the current transaction or can be accumulated. The number of loyalty points per transaction is calculated as follows: For purchases of R 500.00 or less, 1 loyalty point will be awarded per R 50.00 spent. For purchases of more than R 500.00 the following applies: For the first R 500.00, 1 loyalty point will be awarded per R 50.00 spent For the remainder of the amount, 2 loyalty points will be awarded per R50.00 spent. Examples: For purchases of R 460.00, 9 loyalty points will be awarded. For purchases of R 660.00, 10 loyalty points will be awarded for the first R 500.00 and 6 loyalty points for the remaining R 160.00 = 16 loyalty points For purchases of R 1250.00, 10 loyalty points will be awarded for the first R 500.00 and 30 loyalty points for the remaining R 750.00 = 40 loyalty points The monetary value of the loyalty points is calculated as follows: The first 30 loyalty points are worth 25c each. Loyalty points from 30 up to 50 is worth 40c each. Loyalty points above 50 is worth 60c each. With each transaction the customer can choose to use their loyalty points in which case the customer will receive the monetary value of the total number of loyalty points and the total will be set to 0. 2 If the total number of loyalty points reaches a total of 50 when a transaction takes place, the customer automatically receives the monetary value of the total number of points. If a total of 50 or more points is reached within 3 transactions, the customer also receives a 5% discount on the current purchase amount. Do the following: Write code to simulate a number of transactions done by one customer. The user must enter purchase amounts for a number of transactions. Use the value of -1 as purchase amount to quit input. For each transaction display the number of loyalty points earned with the current transaction, the total number of loyalty points and the monetary value of the total number of loyalty points. If the total number of points did not reach the value of 50 yet with the current transaction, the user must indicate whether the points will be used or not. If the points are used, the total number of points must be set to 0. If the total number of points reaches the value of 50 with the current transaction, the user does not have a choice to use the points. The points will automatically be used and the total number of points will be set to 0. A discount must be calculated and displayed if applicable.
Loyalty points are awarded by a company based on the amount a customer spend. Loyalty points can be used immediately with the current transaction or can be accumulated.
The number of loyalty points per transaction is calculated as follows:
For purchases of R 500.00 or less, 1 loyalty point will be awarded per R 50.00 spent. For purchases of more than R 500.00 the following applies: For the first R 500.00, 1 loyalty point will be awarded per R 50.00 spent For the remainder of the amount, 2 loyalty points will be awarded per R50.00 spent.
Examples:
For purchases of R 460.00, 9 loyalty points will be awarded. For purchases of R 660.00, 10 loyalty points will be awarded for the first R 500.00 and 6 loyalty points for the remaining R 160.00 = 16 loyalty points For purchases of R 1250.00, 10 loyalty points will be awarded for the first R 500.00 and 30 loyalty points for the remaining R 750.00 = 40 loyalty points
The monetary value of the loyalty points is calculated as follows:
The first 30 loyalty points are worth 25c each. Loyalty points from 30 up to 50 is worth 40c each. Loyalty points above 50 is worth 60c each.
With each transaction the customer can choose to use their loyalty points in which case the customer will receive the monetary value of the total number of loyalty points and the total will be set to 0.
2
If the total number of loyalty points reaches a total of 50 when a transaction takes place, the customer automatically receives the monetary value of the total number of points. If a total of 50 or more points is reached within 3 transactions, the customer also receives a 5% discount on the current purchase amount.
Do the following:
Write code to simulate a number of transactions done by one customer. The user must enter purchase amounts for a number of transactions. Use the value of -1 as purchase amount to quit input.
For each transaction display the number of loyalty points earned with the current transaction, the total number of loyalty points and the monetary value of the total number of loyalty points. If the total number of points did not reach the value of 50 yet with the current transaction, the user must indicate whether the points will be used or not. If the points are used, the total number of points must be set to 0. If the total number of points reaches the value of 50 with the current transaction, the user does not have a choice to use the points. The points will automatically be used and the total number of points will be set to 0. A discount must be calculated and displayed if applicable.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images