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 R50.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. Do the following: Write a C++ 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. 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. 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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

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 R50.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.

Do the following:
Write a C++ 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.

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.

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.

Example outputs are given in the following images.

Another example run:
Enter purchases amount (-1 to quit input): 300
Points earned with this transaction: 6
Total points : 6
Monetary value: R 1.50
Do you want to use your points (Y or N)? n
Enter purchases amount (-1 to quit input): 250
Points earned with this transaction: 5
Total points : 11
Monetary value: R 2.75
Do you want to use your points (Y or N)? n
Enter purchases amount (-1 to quit input): 375
Points earned with this transaction: 7
Total points : 18
Monetary value: R 4.50
Do you want to use your points (Y or N)? n
Enter purchases amount (-1 to quit input): 145e
Points earned with this transaction: 48
Total points : 66
Monetary value : R 25.10
You have reached the maximum points limit.
You will receive the value of your points with this transaction.
Enter purchases amount (-1 to quit input): -1
Done
Transcribed Image Text:Another example run: Enter purchases amount (-1 to quit input): 300 Points earned with this transaction: 6 Total points : 6 Monetary value: R 1.50 Do you want to use your points (Y or N)? n Enter purchases amount (-1 to quit input): 250 Points earned with this transaction: 5 Total points : 11 Monetary value: R 2.75 Do you want to use your points (Y or N)? n Enter purchases amount (-1 to quit input): 375 Points earned with this transaction: 7 Total points : 18 Monetary value: R 4.50 Do you want to use your points (Y or N)? n Enter purchases amount (-1 to quit input): 145e Points earned with this transaction: 48 Total points : 66 Monetary value : R 25.10 You have reached the maximum points limit. You will receive the value of your points with this transaction. Enter purchases amount (-1 to quit input): -1 Done
Example run:
Enter purchases amount (-1 to quit input): 227
Þoints earned with this transaction: 4
Total points : 4
Monetary value: R 1.00
þo you want to use your points (Y or N)? y
Enter purchases amount (-1 to quit input): 178
Þoints earned with this transaction: 3
Total points : 3
Monetary value: R 0.75
þo you want to use your points (Y or N)? n
Enter purchases amount (-1 to quit input): 99
Þoints earned with this transaction: 1
Total points: 4
Monetary value: R 1.00
þo you want to use your points (Y or N)? n
Enter purchases amount (-1 to quit input): 49
Þoints earned with this transaction: e
Total points : 4
Monetary value: R 1.00
bo you want to use your points (Y or N)? n
Enter purchases amount (-1 to quit input): -1
þone
Transcribed Image Text:Example run: Enter purchases amount (-1 to quit input): 227 Þoints earned with this transaction: 4 Total points : 4 Monetary value: R 1.00 þo you want to use your points (Y or N)? y Enter purchases amount (-1 to quit input): 178 Þoints earned with this transaction: 3 Total points : 3 Monetary value: R 0.75 þo you want to use your points (Y or N)? n Enter purchases amount (-1 to quit input): 99 Þoints earned with this transaction: 1 Total points: 4 Monetary value: R 1.00 þo you want to use your points (Y or N)? n Enter purchases amount (-1 to quit input): 49 Þoints earned with this transaction: e Total points : 4 Monetary value: R 1.00 bo you want to use your points (Y or N)? n Enter purchases amount (-1 to quit input): -1 þone
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY