Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a. [10 points) Write a program to process orders at a coffee shop. Customers can

ID: 2266245 • Letter: A

Question

a. [10 points) Write a program to process orders at a coffee shop. Customers can order tea and/or coffee. A cup of tea costs $1.5 and a cup of coffee costs $1.75.Customers can order multiple cups. For each order, your program needs to keep track of the following information: Customer name, number of tea cups ordered, number of coffee cups ordered, and total cost. When calculating total cost, please include a tax of 13% Your program needs to print a receipt to the console window with the above information. You must use a structure to represent an order. You must use a function that accepts a pointer to the structure as a parameter to calculate total cost. No credit is awarded, if a structure is not used or if a function that accepts a pointer to the structure as a parameter is not used

Explanation / Answer

#include<stdio.h>

void main(void)

{

float Tax = 0.13;

float TeaCost = 1.5;

float CoffieCost = 1.75;

float TotalTeaCost;

float TotalCoffieCost;

struct Bill

{

unsigned char CustName;

float No_of_Tea;

float No_of_Coffie;

float TotalAmount;

float TaxAmount;

float TotalBill;

} Customer_1;

Customer_1.CustName = 'AB';

Customer_1.No_of_Tea= 3;

Customer_1.No_of_Coffie = 4;

TotalTeaCost = Customer_1.No_of_Tea*TeaCost;

TotalCoffieCost = Customer_1.No_of_Coffie*CoffieCost;

Customer_1.TotalAmount = TotalTeaCost + TotalCoffieCost;

Customer_1.TaxAmount = Customer_1.TotalAmount*Tax;

Customer_1.TotalBill = Customer_1.TotalAmount + Customer_1.TaxAmount;

clrscr();

printf(" Customer Name : %c",Customer_1.CustName);

printf(" No. of Tea(s) : %.0f @ $%.2f = %.2f",Customer_1.No_of_Tea,TeaCost,TotalTeaCost);

printf(" No. of Coffie(s) : %.0f @ $%.2f = %.2f",Customer_1.No_of_Coffie,CoffieCost,TotalCoffieCost);

printf(" Total Amount = %.2f",Customer_1.TotalAmount);

printf(" Total Tax = %.2f",Customer_1.TaxAmount);

printf(" Total Bill Amount = %.2f",Customer_1.TotalBill);

getch();

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote