/* *******************
File name: trans.h
*******************
An online store sells 10 items and allow users to add items to
their shopping carts then produce an invoice upon completion of
each transaction */
struct StockItem{
int s_id;
char s_desc[100];
float s_price;
} stock_list[10] = {
{111, "50\" LED TV", 1500.00}, {112, "75\" Smart LED TV", 12000.00},
{211, "Home Theater", 250.00}, {221, "3D Sound System", 300.00},
{511, "6\" e-reader", 400.00}, {611, "64GB USB Flash Drive", 50.00},
{612, "128GB USB Flash Drive", 95.00}, {621, "64GB Micro SD Card", 75.00},
{711, "7\" Tablet", 300.00},{611, "10.1\" Tablet", 500.00}
};
/* A transaction item stores the item's id and quantity */
typedef struct Item{
int item_id;
int quantity;
} Item;
/* A transaction consists of the name of the customer, number
of purchased items and array of purchased items */
struct Transaction{
char customer_name[100];
int items_count;
Item* items;
};
/* 1- read_item reads an item information from the keyboard and returns it */
Item read_item();
/* 2- new_trans prepares a transaction structure with a customer name cn
and an empty list of items, the list should big enough to hold (size)
Items, and returns a pointer to the transaction */
struct Transaction* new_trans(char* cn, int size);
/* 3- purchase_item adds the item (it) to the transaction (tr). If (tr)
contains (it) already, just increase the quantity of the corresponding
item, otherwise add (it) as a new item */
void purchase_item(struct Transaction* tr, Item it);
/* 4- remove_item removes the item (it) from the transaction (tr) if it exists.*/
void remove_item(struct Transaction* tr, Item it);
/* 5- calc_total takes a transaction and returns the total amount
that should be paid by the customer for this transaction */
float calc_total(struct Transaction* tr);
/* 6- main function does the following:
- ask the customer to enter his/her name
- ask the customer to enter number of items in his transaction
- creates a new transaction with a suitable size
- reads the items from the keyboard and add them to the transaction
- printf an invoice of the transaction in the form:
Mr./Mrs. <Customer Name>
Total amount: S.R. <Total Amount> */
Dear Sir,
I have read and understood your project requirements and I'm very interested to work on it. I have experience of programming in C. I have done many programs in C and I write well formatted code with comments. Looking forward to work on your project. Waiting for your positive reply. Thank you