Question: Please help me with this c program. this is without the function prototypes. typedef struct { char OrderName [ 5 0 ] ; / /
Please help me with this c program.
this is without the function prototypes.
typedef struct
char OrderName; stores the first name of the customer
int OrderNumber; stores the order number of the customer
double OrderAmount; stores the order amount
char location; stores the customers location
char validOrder;stores V for valid or I invalid
customer;
int main
declare character for the choice
char choice;
declare an array of customers inventory
customer inventory;
declare count for the array
count ;
greet the user
fill five customers into the array
set count to
printf
FIVE Valid customers have been added to the inventory.
;
get the choice initialization
while choice Qtest
ProcessMenuchoice inventory, &count;
choice GetChoice; update
printf
Have a great day!";
return ;
greet the user
fill the inventory with five customers
void FillFivecustomer inventory
customer temp "Iron.Man", "Malibu", V;
inventory temp;
add more
Display the menu, ask, get, and return the user choice
run the program menu process the choice
use if else conditions or switch
void ProcessMenuchar choice, customer inventory int countPtr
if choice A
add customer to list
add one to count
countPtr countPtr ;
else if choice P
printf
There are d orders
countPtr;
declare ask and get the order number
int number;
use a loop to make sure the user enters a valid order number
PrintOneCustomerinventorynum ;
else if choice V
call the print valid inventory function
else if choice C
printfCreating a report";
call print file function
else if choice I
call make invalid function
else if choice E
double amount;
ask and get the amount
loop through the array to display
else if choice T
calculate the total and the average
else printf
Not valid";
print ONE customer information onto the screen
void PrintOneCustomercustomer info
printf
;
printf
Order number:ttd info.OrderNumber;
add the rest
print entire VALID customer inventory onto the screen
void PrintValidListcustomer inventory int count
int i;
for i ; i count; i
if inventoryivalidOrder V
only print valid orders
print entire customer inventoryvalid and invalid into a file
void PrintListToFilecustomer inventory int count
FILE outPtr;
outPtr fopenreporttxtw;
int i;
for i ; i count; i
fprintfoutPtr
;
fprintfoutPtr
Order number:ttd inventoryiOrderNumber;
add the rest
fcloseoutPtr;
Add a new customer into the inventory
void AddCustomerToListcustomer inventory int count
set the oder number based on the count
inventorycountOrderNumber count ;
get the name
printfPlease enter the name of the order: ;
scanfs inventorycountOrderName;
add the additional prompts and scanf statements
set the order as valid
inventorycountvalidOrder V;
make a customer invalid
void MakeInvalidcustomer inventory int count
printf
There are d orders
count;
declare ask and get the order number
int number;
use a loop to make sure the user enters a valid order number
inventorynumber validOrder I;
order number is one greater than the index, examples:
index is order number is
inedx is order number is
Calculate the total and the average of all the valid orders
void CalculateTotalAveragecustomer inventory int count
int i totalCount ;
double sum avg;
loop through the array to add up all the amounts that are valid
be sure to keep a total count for the average
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
