Coffee+Shop



A coffee shop owner wants you to write a program to process orders taken at the till of her shop. Coffees normally cost £2.85 but when large groups place an order they qualify for extra rewards – if they have a reward card.

Rewards are offered as follows (if a reward card is presented):

1 – 4 coffees = 0 free 5 – 8 coffees = 1 free 9 – 15 coffees = 2 free 16 – 20 coffees = 3 free

The program should:


 * ask for the customer’s first name
 * ask the user if they have a reward card and validate (acceptable responses: “y”, “n”, “yes”, “no”)
 * input and validate the number of coffees ordered (minimum 1, maximum 20)
 * decide on the number of free coffees (if a reward card has been presented)
 * calculate the final cost of the order
 * display:
 * the customer’s first name
 * the number of coffees ordered
 * whether there a reward card was presented
 * a message recommending the customer get a reward card if they don’t already have one
 * the number of free coffees
 * the total cost

You should supply your own test data table designed to make sure that the program functions correctly.

You need to:
 * write the program with clear internal commentary explaining the purpose of the constructs and data types and what they are doing within the program
 * test the program thoroughly to include: normal, extreme and exceptional test data



 A coffee shop owner wants you to write a program to process orders taken at the till of her shop. Coffees normally cost £2.85 but when large groups place an order they qualify for extra rewards – if they have a reward card.

Rewards are offered as follows (if a reward card is presented): 1 – 4 coffees = 0 free 5 – 8 coffees = 1 free 9 – 15 coffees = 2 free 16 – 20 coffees = 3 free

The program should:

· ask for the customer’s first name · ask the user if they have a reward card and validate (acceptable responses: “y”, “n”, “yes”, “no” · input and validate the number of coffees ordered (minimum 1, maximum 20)  · decide on the number of free coffees (if a reward card has been presented)  · calculate the final cost of the order  · display:    o the customer’s first name  o the number of coffees ordered  o whether there a reward card was presented  o a message recommending the customer get a reward card if they don’t already have one  o the number of free coffees  o the total cost

You should supply your own test data table designed to make sure that the program functions correctly.

You need to: · write the program with clear internal commentary explaining the purpose of the constructs and data types and what they are doing within the program · test the program thoroughly to include: normal, extreme and exceptional test data · describe how the computer processes the program using the fetch-execute cycle with reference to program instructions and variables.