Use c code to add the function in the program to provide for purchase amount of RM80.00 or more, the delivery charge is waived  and for purchase amount of RM100 or more, a 15% discount is given.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 16RQ
icon
Related questions
Question

#include <stdio.h>

#include <stdlib.h>

#include<string.h>

#pragma warning(disable:4996)

int main(void) {

// Variable declarations int t = 0; float k,y,u,i; int a,b,c,d; int p; float add,tt; char name[30],ic[20]; char addr[50]; //The personal details of customer // printf("\n=================================================================================\n"); printf("\n Vegetable ordering system\n"); printf("\n=================================================================================\n"); printf("Please 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 come from %s",addr); printf("\n==================================================================================\n"); //Order part of program// printf("\n==================================================================================\n"); printf(" Enter the order quetity purchase \n"); printf("\n==================================================================================\n"); printf("Please order the package A :"); scanf("%d", &a); printf("Please order the package B :"); scanf("%d", &b); printf("Please order the package C :"); scanf("%d", &c); printf("Please order the package D :"); scanf("%d", &d); printf("\n==================================================================================\n"); if (a,b,c,d > t) { printf("%d", a- t); k = (24.5)*a; printf("\nPackages A :RM%.2f\n", k); y = (26.5) * b; printf("\nPackages B :RM%.2f\n", y); u= (26.5) * c; printf("\nPackages C :RM%.2f\n", u); i = (24.5) * d; printf("\nPackages D :RM%.2f\n\n", i); //The addition part for total cost for customer to pay// add = k + y + u + i; tt = add + 5.90; printf("Total =RM%.2f\n", add); printf("The delivery fee which is fixed =RM5.90\n "); printf("\n==================================================================================\n"); printf("The total price for customer need to pay =RM%.2f\n",tt); printf("\n==================================================================================\n"); system("pause");

return 0;

}

}

• Use c code to add the function in the program to provide for purchase amount of RM80.00 or more, the delivery charge is waived
 and for purchase amount of RM100 or more, a 15% discount is given.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT