Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include using namespace std; // ToDo: define a function updateLoyaltyCard that takes an integer points // and a purchase price. // @returns points incremented if

image text in transcribed

#include using namespace std;

// 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 purchase

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago