Answer to Question #158458 in C for Muhammad Usama

Question #158458

Jerri Khan established a roadside tea stall 1983. Over the years the number of customers and 

products have grown. Due to the increase in the business Jerri has hired staff for various 

positions including cashiers and waiter to provide service round the clock.

Jerri found that it was easier to manage the shop by himself, but since the business has grown 

and number of staff are involved, he requires a mechanism to get a clear visibility of the day-to-

day operations of the shop. He has been recommended to put in a cheap computer with a 

software for the cashier’s desk.

Generally, people walk into the shop and take any available seat. The order is taken by the 

waiter. The customers can choose any item(s) mentioned in the menu (sample as follows).

The customers need to settle the bill as the cashier’s counter before leaving the premises. The 

cashier enters the items ordered by the customers into the system. This helps keep the detailed 

record of sales. A sample of the receipt is as follows:

You are required to write console mode applications using C Programming for the following 

tasks.



Task #1 Marks

Write a to create a catalogue of products that are sold in the shop. The situation requires that you 

allow Jerri to:

1. Add Items by Entering in real time.

2. Add Items by Importing from plain text file

3. Remove a single item

4. Remove all items

Make sure that the items are uniquely identifiable.


Task #2 Marks

Write a program for the cashier(s) to allow them to record day-to-day transaction. The program 

should allow the cashier to add items to invoice from the catalogue created in Task #1. The 

invoice should contain:

1. List of items purchased by the customer

2. Unit price of each item

3. Quantity purchased

4. Subtotal of each item

5. Total Value of all items purchased.


Task #3 Marks

Write a program that will allow Jerri to generate summarized report of the daily transaction. The 

report should contain following:

1. Quantity of the items sold for every item on the catalogue

2. Total of amount sales in Rupees for every item on the catalogue

3. Sum of All the daily sales


Task #4 Marks

1. Write a user manual for Task #1, Task #2, and Task #3.

Create user manuals to help train Jerri and the cashiers to use the system.

1. Write a technical documentation for Task #1, Task #2, and Task #3.



1
Expert's answer
2021-01-26T05:33:42-0500
#include<stdio.h>

#include<stdlib.h>

#include <string.h>

#define item 100

struct customer{

int id;

char description[50];

float price;

}product;

void main()

{

int n,i,ch,m;

struct product item[];

printf("Enter 1 to the Add Items\nEnter 2 for the Add Items from File\nEnter 3 for Remove a single item\nEnter 4 Remove all items\n");

scanf("\t%d",&ch);

switch (ch)

{

// For Adding Items

case 1:

printf("Enter no.of items");

scanf("%d",&n);

for(i=0;i<n;i++)

{

fflush(stdin);

printf("Item Code- ");

scanf("%d",&item[i].id);

printf("\nEnter Description");

scanf("\t%s",item[i].description[50]);

printf("\nPrice");

scanf("\t%f",&item[i].price);

}

break;

case 2:

FILE* in_file = fopen("Filename", "r"); // read only

if (! in_file ) // equivalent to saying if ( in_file == NULL )

{

printf("oops, file can't be read\n");

exit(-1);

}

while ( fscanf(file, "%d", & number ) == 1 )

{

printf("We just read %d\n", number);

}

break;

case 3:

int count=(int) sizeof(item);

printf("Enter Id of the item to be Remove\n");

scanf("%d",&m);

for (int i = 0; i < count; i++)

{

if( m==item[i].id)

{

for (int i = 0; i < count; i++)

{

if( m==item[i].id){

strcpy(item[i].id, (int)nullStr);//put null into that place

strcpy(item[i].description, nullStr);

strcpy(item[i].price, (float)nullStr);

count--;

break;

}

}

}

else

{

printf("No item is present in the List\n");

}

}

case 4:

for (int i = 0; i < count; i++)

{

free(item[i].id);

free(item[i].description);

free(item[i].price);

}

printf("Removed all the items from the list\n");

}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS