1) please someone help me ,based on the program given how can i add two extra features  to the program. to show  what packages is most people to buy . to show the total of customer .

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

1) please someone help me ,based on the program given how can i add two extra features  to the program.

  • to show  what packages is most people to buy .
  • to show the total of customer .

 

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning(disable : 4996)

int main(void)
{

//Package category array
char category[]= { 'A', 'B', 'C', 'D' };
//Price array
float price[] = { 24.50, 26.00, 27.50, 29.00 };
//Quantiy array
int quantity[] = { 0, 0, 0, 0 };
int count = 1;
int qtyA = 0, qtyB = 0, qtyC = 0, qtyD = 0;
float total = 0.0, discount = 0.0, delivery = 0.0, net = 0.0;
char ch = 'A', choice = 'Y';
int p = 0;
char name[50], ic[20], addr[100];

printf("\n<MENU PRICES OF VEGETABLE>");
printf("\n===============================================================================");
printf("\n MR.KOK VEGETABLE ORDERING SYSTEM");
printf("\n===============================================================================");
printf("\n Packages \t\t\t\t Price ");
printf("\n A (kangkung,cabbage,Ladies finger,banana) RM 24.50 ");
printf("\n B (Yam leaves,long bean,brinjal,guava) RM 26.00 ");
printf("\n C (snake beans,broccoli,spinach,papaya) RM 27.50 ");
printf("\n D (bak choy,asparagus,brinjal,dragon fruit) RM 29.00 ");
printf("\n===============================================================================");

 

//Continue taking customer input till choice is not 'N' or 'n'

while (choice != 'n' && choice != 'N')
{
printf("\nCustomer no. : %d", count++);
printf("\nPlease enter your full name :");
scanf(" %[^\n]", &name);
printf("Please enter your ic number :");
scanf("%s", &ic);
printf("Please enter your phone number :");
scanf("%d", &p);
printf("Please enter your home address :");
scanf(" %[^\n]", &addr);
printf("\n========================================================================================================\n");
printf("The customer name is %s and the ic number is %s \n", name, ic);
printf("The customer who is come from %s", addr);
printf("\n========================================================================================================\n");


//Continue taking the package and quantity input till X

while (ch != 'X')
{
printf("\nPACKAGE A,B,C,D (X = EXIT) : ");
scanf(" %c", &ch);

//Increment respective quantity of each category

if (ch == 'A')
{
printf("\nQuantity : ");
scanf("%d", &qtyA);
quantity[0] += qtyA;
}

if (ch == 'B')
{
printf("\nQuantity : ");
scanf("%d", &qtyB);
quantity[1] += qtyB;
}

if (ch == 'C')
{
printf("\nQuantity : ");
scanf("%d", &qtyC);
//getchar();
quantity[2] += qtyC;
}

if (ch == 'D')
{
printf("\nQuantity : ");
scanf("%d", &qtyD);
//getchar();
quantity[3] += qtyD;
}
}

//Print the details of package and add to total
printf("\n=======================================================================");

if (qtyA != 0)

{

printf("\nPACKAGE A : %d @ RM 24.50 = RM %.2f", qtyA, qtyA * price[0]);

total += qtyA * price[0];
}

if (qtyB != 0)

{
printf("\nPACKAGE B : %d @ RM 26.00 = RM %.2f", qtyB, qtyB * price[1]);

total += qtyB * price[1];
}

if (qtyC != 0)

{

printf("\nPACKAGE C : %d @ RM 27.50 = RM %.2f", qtyC, qtyC * price[2]);

total += qtyC * price[2];
}

if (qtyD != 0)
{

printf("\nPACKAGE D : %d @ RM 29.00 = RM %.2f", qtyD, qtyD * price[3]);

total += qtyD * price[3];
}

printf("\n=======================================================================\n");

//Check the total value of purchase and update the delivery and discount

if (total > 80)
{

printf("\nPACKAGE CHARGES : RM %.2f", total);

if (total > 100)
{

delivery = 0.0;

printf("\nDelivery fees : RM%.2f", delivery);

discount = 0.15 * total;

printf("\nDiscount : RM%.2f", discount);
}

//Calculate the net amount to be paid by Customer

net = total + delivery - discount;
}

else
{

printf("\nPACKAGE CHARGES : RM %f", total);

delivery = 5.0;

printf("\nDelivery fees : RM%.2f", delivery);

discount = 0.0 * total;

printf("\nDiscount : RM%.2f", discount);

net = total + delivery - discount;
}

//print the total amount

printf("\nTotal to pay : RM %.2f", net);

ch = 'A';
qtyA = 0;
qtyB = 0;
qtyC = 0;

printf("\n\nTHANK YOU, HAVE A NICE DAY!");

qtyD = 0;
total = 0.0;

//Ask if next Customer is available

printf("\n\nNext Customer ? (Y/N) : ");
scanf(" %c", &choice);
}

//Print the daily sales report
printf("\n=======================================================================");
printf("\n\n>>>>>>>>>>>>>>>>>>>>>>>>DAILY SALES REPORT<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
printf("\n=======================================================================");
printf("\nPACKAGE\tQUANTITY SOLD\tSALES AMOUNT\n");
printf("\n=======================================================================\n");
int i = 0;

while (i < 4)
{
printf("%c\t%d\t\t%.2f\n", category[i], quantity[i], quantity[i] * price[i]);
i++;
}
printf("\n=======================================================================");
return 0;
}

 

Discount : RM41. 25
Total to pay: RM 233.75
THANK YOU, HAVE A NICE DAY!
Add two extra features before the
daily sales report
Next Customer ? (Y/N) : N
>DAILY SALES REPORT<<<«
く<ㄍ<
PACKAGE QUANTITY SOLD SALES AMOUNT
A
24. 50
52. 00
82. 50
116. 00
C
123 4
Transcribed Image Text:Discount : RM41. 25 Total to pay: RM 233.75 THANK YOU, HAVE A NICE DAY! Add two extra features before the daily sales report Next Customer ? (Y/N) : N >DAILY SALES REPORT<<<« く<ㄍ< PACKAGE QUANTITY SOLD SALES AMOUNT A 24. 50 52. 00 82. 50 116. 00 C 123 4
ACKAGE A,
exit):
%3!
Quantity
: 2
RM
78.00
РАСКАGE B: зе вм 26
PACKAGE D: 2 @ RM 29
= RM
58.00
PACKAGE Charges = RM
Delivery fees
Discounts
Total to pay
136.00
= RM
0.00
= RM
20.40
= RM
115
THANK YOU, HAVE A NICE DAY!!
Add this feature
Next customer (Y=yes?) : n
DAILY SALES SUMMARY REPORT
Add one more feature after this line
Total Number of Customers = 2
PACKAGE
To show what packages is most
people to buy
Quantity Sold
Sales Amount
A
24.50
4
104.00
1
27.50
58.00
ТОTAL
214.00
Transcribed Image Text:ACKAGE A, exit): %3! Quantity : 2 RM 78.00 РАСКАGE B: зе вм 26 PACKAGE D: 2 @ RM 29 = RM 58.00 PACKAGE Charges = RM Delivery fees Discounts Total to pay 136.00 = RM 0.00 = RM 20.40 = RM 115 THANK YOU, HAVE A NICE DAY!! Add this feature Next customer (Y=yes?) : n DAILY SALES SUMMARY REPORT Add one more feature after this line Total Number of Customers = 2 PACKAGE To show what packages is most people to buy Quantity Sold Sales Amount A 24.50 4 104.00 1 27.50 58.00 ТОTAL 214.00
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY