Question
#include using namespace std; // ToDo: define a function updateLoyaltyCard that takes an integer points // and a purchase price. // @returns points incremented if
#include
// ToDo: define a function updateLoyaltyCard that takes an integer points // and a purchase price. // @returns points incremented if price is $10 or greater, // otherwise return points unchanged.
int main() { // ToDo: declare variables for customer A,B,C. An input for the customer // and an input for the purchase total // ToDo: read customer name data until 'N' is read, // only read purchase if not 'N' // ToDo: If the customer is 'A', update loyalty points for 'A // ToDo: If the customer is 'B', update loyalty points for 'B' // and so on. // ToDo: print the customer and their current points return 0; }
The Spaghetti Code Cafe uses a computer program to keep track of customer loyalty. Unfortunately, there have been many problems. Some customers complain that they have too few loyalty points. Others quietly take advantage when the computer tells them they have extra points. Revise the program to keep track of loyalty points for three customers: A, B, and C. When a customer makes a purchase, two lines will be read: A char: 'A', 'B', or 'C' or 'N' for nobody indicating which customer made the purchase A float value indicating how much the customer paid, in dollars . The input of 'N' indicates that there are no more purchases left and the program should end. The loyalty program requirements are: . When a customer makes a purchase totalling $10.00 or more, they get one loyalty point No customer should gain or lose loyalty points due to another customer's purchaseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started