Question
Create an array to store the total price that should be paid by each customer. Calculate the total profit earned by adding total price from
Create an array to store the total price that should be paid by each customer. Calculate the total profit earned by adding total price from all customers who have ordered and display a message You achieve target today if the total profit for the day is more than RM5000, otherwise display Need more effort.
using programin C and GDB online
the output should be like the picture below
implement using into this code :
( if there are any error in code edit it please )
#include
float calculateprice(float delFee ,int rose ,int guci ,int coco ) ;
int main() { char CusN[200] ; int coco , rose , guci , close ; float bill , delFee , Sum ; int location ; while (close == 1) { printf("Welcome Anis De Essence shop ");
printf("Enter customer name : %s " , CusN ); scanf ("%s" , &CusN) ; printf("Enter quantity for Coco Chanel :%d " , coco ); scanf ("%d" , & coco); printf("Enter quantity for Rose Bbgari : %d " , rose ); scanf ("%d" , & rose); printf("Enter quantity for flower Guci : %d " , guci ); scanf ("%d" , & guci); printf("choose customer location 1- Selangor 2- pahang 3- KL : " , location ); scanf ("%d" , & location); if (location == 1 ) { delFee = 20.00 ; } else if (location == 2 ) { delFee = 25.00 ; } else if (location == 3 ) { delFee = 15.00 ; scanf ("%f" , & delFee); } printf ( "delivery price is : %f " , delFee ) ; Sum = calculateprice(delFee , rose , guci , coco ); printf ("Total price to be paid by %s including delivery = %f " , CusN , Sum ); printf (" please print 1 for menu and 0 to close "); scanf ("%d" , & close ) ; } return 0 ; }
float calculateprice (float delFee , int rose ,int guci , int coco ) { float bill ; bill = ((coco * 150) + (rose * 200) + (guci * 180) + delFee ); return bill ; }
You may refer sample output as in Figure 4. A CAWindows\system32\cmd.exe Rectangular Ship Welcome Anis De Essence shop Enter customer name : Aziz Enter quantity for Coco Chanell: 5 Enter quantity for Rose Bbgari : 2 Enter quantity for Flower Guci : 0 Choose customer locationStep 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