Académique Documents
Professionnel Documents
Culture Documents
Submitted in partial fulfillment for the degree of Bachelor of Science (Hons) in Computing
STUDENT DECLARATION: I Declare that: We understand what is meant by plagiarism. The implications of plagiarism have been explained to us by our lecturer. This project is all our work and I have acknowledged any use of the published or unpublished works of other people. Group Leaders Signature : Date : 25th January 2011
Total number of pages : 49 pages Submission Date : Students Names and ID : 25 January 2011 Leader :
th
49 pages
ACKNOWLEDGEMENTS
Firstly we would like to thank our lecturer Mr.Thangavel Saravanan for all the help and guidance given to us while doing this assignment. Especially for teaching us this module in such a way that we were able to learn this highly technical module very easily. Also there are many individuals who have helped us in numerous ways directly and indirectly so that we were able to complete this assignment. APIIT Lanka for providing us with resources and the Tech Team at APIIT Lanka for their assistance at required times. And last but not least our friends, parents and the well-wishers without whose moral support and encouragement, we would not have been able to do a good job. Finally, if there are any shortcomings in this project, then we request to excuse us for all those and accept this documentation. Ahamed Nishadh Deshan Ilangakoon Tiffaniya Fernando
ii
TABLE OF CONTENTS
1.0 - INTRODUCTION ............................................................................................... 1 1.1 OBJECTIVES ............................................................................................. 1 1.2 KEY SUCCESS CRITERIA ...................................................................... 1 1.3 CONSTRAINTS ......................................................................................... 1 2.0 PROJECT DESCRIPTION ................................................................................. 2 3.0 PSEUDO CODE.................................................................................................. 5 4.0 SOURCE CODE ................................................................................................. 6 5.0 PROGRAMMING CONCEPTS APPLIED ...................................................... 22 5.1 IF, ELSE Conditions ................................................................................. 22 5.2 LOOPS (WHILE AND DO-WHILE) ...................................................... 22 5.3 SWITCH COMMANDS .......................................................................... 23 5.4 STRUCTURES ......................................................................................... 24 5.4.1 DEFINING A STRUCTURE............................................................. 24 5.4.2 DECLARING STRUCTURE VARIABLE ....................................... 24 5.4.3 USING STRUCTURE VARIABLES ................................................ 24 5.5 FUNCTIONS ............................................................................................ 24 5.5.1 DEFINING FUNCTIONS ................................................................. 24 5.5.2 DECLARING FUNCTIONS ............................................................. 25 5.5.3 CALLING FUNCTIONS ................................................................... 26 6.0 USER GUIDE ................................................................................................... 27
iii
6.1 MAIN MENU ........................................................................................... 27 6.2 NEW ORDER ........................................................................................... 28 6.2.1 NEW ORDER: BREAD TYPE ......................................................... 29 6.2.2 NEW ORDER: SANDWICH SIZE ................................................... 30 6.2.3 NEW ORDER: TOPPING ................................................................. 30 6.2.4 NEW ORDER: NO. OF SANDWICHES REQUIRED ..................... 32 6.2.5 NEW ORDER: CONFIRM ORDER ................................................. 34 6.2.6 NEW ORDER: PAYMENT METHOD ............................................ 34 6.2.7 NEW ORDER: FINAL BILL CASH PAYMENT ......................... 35 6.2.8 NEW ORDER: FINAL BILL CREDIT CARD PAYMENT ......... 36 6.2.9 INVALID ENTRY ............................................................................. 36 6.3 CHECK AVAILABLE SANDWICHES .................................................. 37 6.4 - EXIT .......................................................................................................... 39 7.0 LIMITATIONS AND FUTURE ENHANCEMENTS ..................................... 40 7.1 LIMITATIONS......................................................................................... 40 7.2 FURTHER ENHANCEMENTS .............................................................. 40 8.0 CONCLUSION ................................................................................................. 41 9.0 BIBLIOGRAPHY ............................................................................................. 42 10.0 AGREED WORK PERCENTAGE................................................................. 43
iv
1.0 - INTRODUCTION
This program is a Point of Sale System for a Sandwich Bar. This system will be only used by the shops assistant who will enter the order as the customer provides the requirements. The system will take the order; do all necessary calculations and printing the receipts. The guide lines that we will use when doing the development of the project will be according to the objectives, given below that we hope to achieve by the end of the development.
1.1 OBJECTIVES
Make a faster and more reliable point of sale system for the Sandwich Bar. Generate accurate and up to date reports for management on the performance of the shop. Maintain all transaction details and store this information in a separate file. Make the system easy and simple for the user to operate.
1.3 CONSTRAINTS
In the case where the project encounters problems and Code needs to be changed the company will need someone with professional knowledge in C Programing language for assistance. The system will need a C compiler to operate and this software does not come pre-installed in most computers.
Medium and Small. The system will then take the user to the next process which is the topf Function. Here the user must enter the toping that he wishes to have on the sandwich. He is provided with three options 1-Cheese, 2-Meyoneese and 3-Special Sauce. The user can have either one, two or all three of the toppings. He can also opt not to have any of the available toppings. This process works by having a While loop and a Do While loop that will run three times asking the user to enter a topping or until the user opts to exit the topping option by selecting 0 that will jump the system out of the loop. After the user has given the specifications for his sandwich the user will then be asked how many sandwiches he wishes to have of the particular type that he has selected. For this the function qytf will be called up. Here when the user enters the choice the system will run a check to see if there is sufficient filling to satisfy the customers requirement. If there is not the system will prompt an error saying that there is insufficient filling to meet the order requirement for that particular type of filling. Here the user will have to re-enter a quantity that meets the available amount present in the system. If there is sufficient amount of filling to meet the customers order then the system moves on to the next function is the the invoice Function. Here the user is presented with a screen showing his order and will request the user to select whether the order displayed is in fact correct. If it is not the user must enter n and the system will then return back to the main menu and the user can start the process again. If the order is correct the user will have to enter y and the system will take the user to the next stage of the process. When the user has confirmed that the order is in fact what was requested then the system will ask the user what the method of payment will be. Here there are two options available for the user. One the user can select to make the payment by Cash. If the user selects this option then the system will simply display the final bill for the user.
3
If however the user selects to make a payment by credit card then the system will again move to the final bill process but here if the user has made an order that is greater than Rs. 1,000/= he is eligible to receive a discount of 10% if the credit card type is Visa Credit Card. Here we have made the assumption that the Sandwich Bar will only accept Visa Credit Card. Once this is done the system will show the bill containing the individual price per sandwich, the relevant discount that takes into effect and the Grand Total. After this the user can return to the main menu to either make a new order or to select one the two remaining options. The next option that the user is presented with when the system is at the main menu is the option to check how many more sandwiches can be made. This runs through the availability Function. If the user selects this option the system will move into the next segment where the system prompts the user to enter the type of bread that the user wishes to search for. When the user does this the system will display how many more sandwiches of the particular bread type can be made. After this the system will move back to the main menu. The user if he has finished all the work that he has to do with the system may opt to shut the system down. To do this the user simply has to go to the main menu and select the Exit option. This will then shut the program down.
{ int mainmenu; do { clrscr(); printf("\n D.A.T. SANDWICH BAR\n ===================\n\n"); printf(" MAIN MENU\n ---------\n\n\n"); printf(" WHAT DO YOU WANT TO DO :\n 1. New Order\n 2. Check Available Sandwiches\n\n 3. Exit\n\n\n Choice is : "); flushall(); scanf("%d",&mainmenu); switch(mainmenu) { case 1: { neworder(); break; } case 2: { availability(); break; } case 3: { _exit(0); break; } default: { printf("\n INVALID CHOICE!!!\n PRESS ANY KEY TO CONTINUE"); } } getch(); }while (mainmenu<=3||mainmenu>0); }
//"NEW ORDER" FUNCTION STARTS HERE void neworder() { int filling; cancelor=0; do { clrscr();
7
printf("\n D.A.T. SANDWICH BAR\n ===================\n\n"); printf(" NEW ORDER\n ---------\n\n"); printf(" Enter the Type of Filling Required\n 1.Chicken\n 2.Seafood\n 3.Vegetarian\n\n 4.CANCEL ORDER\n\n Choice is : "); flushall(); scanf("%d",&filling); switch(filling) { case 1: { if(ccount<max) { bill[count].filling='C'; if(cancelor==0) { breadf(); } if(cancelor==0) { sizef(); } if(cancelor==0) { topf(); } if(cancelor==0) { qtyf(); } if(cancelor==0) { invoice(); } return; } else { printf("CHICKEN SANDWICHES SOLD OUT!!!"); printf("\nPRESS 'ENTER' TO REENTER CHOICE"); getch(); break; } } case 2: { if(scount<max)
8
{ bill[count].filling='S'; if(cancelor==0) { breadf(); } if(cancelor==0) { sizef(); } if(cancelor==0) { topf(); } if(cancelor==0) { qtyf(); } if(cancelor==0) { invoice(); } return; } else { printf("SEAFOOD SANDWICHES SOLD OUT!!!"); printf("\nPRESS 'ENTER' TO REENTER CHOICE"); getch(); break; } } case 3: { if(vcount<max) { bill[count].filling='V'; if(cancelor==0) { breadf(); } if(cancelor==0) { sizef(); } if(cancelor==0) { topf();
9
} if(cancelor==0) { qtyf(); } if(cancelor==0) { invoice(); } return; } else { printf("VEGETARIAN SANDWICHES SOLD OUT!!!"); printf("\nPRESS 'ENTER' TO REENTER CHOICE"); getch(); break; } } case 4: { cancelor=1; printf("\nORDER CANCELLED!!! PRESS 'ENTER' TO GO TO MAIN MENU"); getch(); return; } default: { printf("\n INVALID CHOICE!!!\n PRESS ANY KEY TO CONTINUE"); getch(); } } }while (filling>0||filling<=4); }
//"BREAD TYPE" FUNCTION STARTS HERE void breadf() { int bread; do { clrscr(); printf("\n D.A.T. SANDWICH BAR\n ===================\n\n");
10
printf(" NEW ORDER\n ---------\n\n"); printf("YOUR CURRENT ORDER\n------------------\n"); printf("Filling : %c\n",bill[count].filling); printf("\n\n Enter the Type of Bread Required\n 1.Baguette\n 2.Foccacia\n 3.Ciabatta\n\n 4.CANCEL ORDER\n\n Choice is : "); flushall(); scanf("%d",&bread); switch(bread) { case 1: { bill[count].bread='B'; if(bill[count].filling=='C') { bill[count].subtotal=200; } if(bill[count].filling=='S') { bill[count].subtotal=300; } if(bill[count].filling=='V') { bill[count].subtotal=100; } return; } case 2: { bill[count].bread='F'; if(bill[count].filling=='C') { bill[count].subtotal=250; } if(bill[count].filling=='S') { bill[count].subtotal=350; } if(bill[count].filling=='V') { bill[count].subtotal=150; } return; } case 3: { bill[count].bread='C'; if(bill[count].filling=='C') { bill[count].subtotal=225;
11
} if(bill[count].filling=='S') { bill[count].subtotal=325; } if(bill[count].filling=='V') { bill[count].subtotal=125; } return; } case 4: { cancelor=1; printf("\nORDER CANCELLED!!! PRESS 'ENTER' TO GO TO MAIN MENU"); getch(); return; } default: { printf("\n INVALID CHOICE!!!\n PRESS ANY KEY TO CONTINUE"); getch(); } } }while (bread<=4||bread>0); }
//"SIZE" FUNCTION STARTS HERE void sizef() { int size; do { clrscr(); printf("\n D.A.T. SANDWICH BAR\n ===================\n\n"); printf(" NEW ORDER\n ---------\n\n"); printf("YOUR CURRENT ORDER\n------------------\n"); printf("Filling : %c\n",bill[count].filling); printf("Bread : %c\n",bill[count].bread); printf("\n\n Enter the Size of the Sandwitch Required\n 1.Large\n 2.Medium\n 3.Small\n\n 4.CANCEL ORDER\n\n Choice is : "); flushall(); scanf("%d",&size); switch(size)
12
{ case 1: { bill[count].size='L'; bill[count].subtotal=(bill[count].subtotal+(bill[count].subtotal*0.2)); return; } case 2: { bill[count].size='M'; bill[count].subtotal=(bill[count].subtotal+(bill[count].subtotal*0.1)); return; } case 3: { bill[count].size='S'; bill[count].subtotal=bill[count].subtotal; return; } case 4: { cancelor=1; printf("\nORDER CANCELLED!!! PRESS 'ENTER' TO GO TO MAIN MENU"); getch(); return; } default: { printf("\n INVALID CHOICE!!!\n PRESS ANY KEY TO CONTINUE"); getch(); } } }while (size<=4||size>0); }
//"TOPPING SELECT" FUNCTION STARTS HERE void topf() { int top,temp=0; bill[count].topping[0]=0; bill[count].topping[1]=0; bill[count].topping[2]=0; do {
13
clrscr(); printf("\n D.A.T. SANDWICH BAR\n ===================\n\n"); printf(" NEW ORDER\n ---------\n\n\n"); printf("YOUR CURRENT ORDER\n------------------\n"); printf("Filling : %c\n",bill[count].filling); printf("Bread : %c\n",bill[count].bread); printf("Size : %c\n",bill[count].size); do { printf("\n\n Enter the Toppings Required\n 1.Cheese (Rs. 50)\n 2.Mayonnaise (Rs.25)\n 3.Special Sauce (Rs.100)\n 0.To STOP Entering\n\n 4.CANCEL ORDER\n\n Choice is : "); flushall(); scanf("%d",&top); if(top!=0) { bill[count].topping[temp]=top; if(top==1) { bill[count].subtotal=bill[count].subtotal+50; temp++; } if(top==2) { bill[count].subtotal=bill[count].subtotal+25; temp++; } if(top==3) { bill[count].subtotal=bill[count].subtotal+100; temp++; } if(top==4) { cancelor=1; printf("\nORDER CANCELLED!!! PRESS 'ENTER' TO GO TO MAIN MENU"); getch(); return; } if(top>4) { printf("\n INVALID CHOICE!!!\n PRESS ANY KEY TO CONTINUE"); getch(); } } else
14
//"QUANTITY" FUNCTION STARTS HERE void qtyf() { int qty; int crem=max-ccount; int srem=max-scount; int vrem=max-vcount; int qtyc=0; do { clrscr(); printf("\n D.A.T. SANDWICH BAR\n ===================\n\n"); printf(" NEW ORDER\n ---------\n\n\n"); printf("YOUR CURRENT ORDER\n------------------\n"); printf("Filling : %c\n",bill[count].filling); printf("Bread : %c\n",bill[count].bread); printf("Size : %c\n",bill[count].size); printf("Sub Total : %.2f",bill[count].subtotal); printf("\n\n HOW MANY SANDWICHES DO YOU WANT\n\n Choice is : "); flushall(); scanf("%d",&qty); switch(bill[count].filling) { case 'C': { if(qty>crem) { printf("REQUESTED AMOUNT NOT AVAILABLE\n"); printf("ONLY %d SANDWICHES AVAILABLE",crem); qtyc=1; printf("\nEnter Quantity Again"); getch();
15
break; } else { bill[count].tqty=qty; qtyc=0; bill[count].subtotal=(bill[count].subtotal*bill[count].tqty); return; } } case 'S': { if(qty>srem) { printf("REQUESTED AMOUNT NOT AVAILABLE\n"); printf("ONLY %d SANDWICHES AVAILABLE",srem); printf("\nEnter Quantity Again"); qtyc=1; getch(); break; } else { bill[count].tqty=qty; qtyc=0; bill[count].subtotal=(bill[count].subtotal*bill[count].tqty); return; } } case 'V': { if(qty>crem) { printf("REQUESTED AMOUNT NOT AVAILABLE\n"); printf("ONLY %d SANDWICHES AVAILABLE",srem); qtyc=1; printf("\nEnter Quantity Again"); getch(); break; } else { bill[count].tqty=qty; qtyc=0;
16
//"INVOICE" FUNCTION STARTS HERE void invoice() { int confirm; do { clrscr(); printf("\n D.A.T. SANDWICH BAR\n ===================\n\n"); printf(" NEW ORDER\n ---------\n\n\n"); printf(" YOUR CURRENT ORDER\n ------------------\n"); printf(" Filling : %c\n",bill[count].filling); printf(" Bread : %c\n",bill[count].bread); printf(" Size : %c\n",bill[count].size); printf(" Sub Total : Rs.%.2f\n",bill[count].subtotal); printf(" Total Number of Sandwitches Required : %d\n",bill[count].tqty); printf("\n\n CONFIRM ORDER (1:Yes/2:No) : "); flushall(); scanf("%d",&confirm); switch(confirm) { case 1:{ paymentf(); billf(); if(bill[count].filling=='C') { ccount=ccount+bill[count].tqty; } if(bill[count].filling=='S') { scount=ccount+bill[count].tqty; } if(bill[count].filling=='V') { vcount=ccount+bill[count].tqty; } count++; printf("Press 'ENTER' to Close the Bill");
17
return; } case 2:{ cancelor=1; return; } default:{ printf("\n INVALID CHOICE!!!\n PRESS ANY KEY TO CONTINUE"); getch(); } } }while(confirm>0 || confirm<=2); }
//"PAYMENT" FUNCTION STARTS HERE void paymentf() { int pay; do { clrscr(); printf("\n D.A.T. SANDWICH BAR\n ===================\n\n"); printf(" NEW ORDER\n ---------\n\n\n"); printf(" YOUR CURRENT ORDER\n ------------------\n"); printf(" Sub Total : Rs.%.2f\n",bill[count].subtotal); printf(" Total Number of Sandwitches Required : %d\n",bill[count].tqty); printf("\n\n\n 1.Cash\n 2.Credit Card\n Payment Method : "); flushall(); scanf("%d",&pay); switch(pay) { case 1:{ bill[count].discount=0; bill[count].total=bill[count].subtotal; bill[count].payment='C'; return; } case 2:{ if(bill[count].subtotal>1000) { bill[count].discount=(bill[count].subtotal*0.1);
18
bill[count].total=bill[count].subtotalbill[count].discount; } else if(bill[count].subtotal<1000) { bill[count].discount=0; bill[count].total=bill[count].subtotal; } bill[count].payment='V'; return; } default:{ printf("\n INVALID CHOICE!!!\n PRESS ANY KEY TO CONTINUE"); getch(); } } }while(pay>0||pay<=2); }
//"BILL PRINTING" FUNCTION STARTS HERE void billf() { clrscr(); printf("\n D.A.T. SANDWICH BAR\n ===================\n\n"); printf(" NEW ORDER\n ---------\n\n\n"); printf(" YOUR ORDER\n ------------------\n"); printf(" Filling : %c\n",bill[count].filling); printf(" Bread : %c\n",bill[count].bread); printf(" Size : %c\n",bill[count].size); printf(" Toppings : %d %d %d\n",bill[count].topping[0],bill[count].topping[1],bill[count].topping[2]); printf(" Total Number of Sandwitches Required : %d\n",bill[count].tqty); printf(" Sub Total : Rs.%.2f\n",bill[count].subtotal); printf(" Discount : Rs.%.2f\n",bill[count].discount); printf(" Payment Method : %c\n",bill[count].payment); printf("\n TOTAL : Rs.%.2f\n \n\n",bill[count].total); }
//*AVAILABILITY" FUNCTION STARTS HERE void availability() { clrscr(); int fill; int crem=max-ccount;
19
int srem=max-scount; int vrem=max-vcount; do { printf("\n D.A.T. SANDWICH BAR\n ===================\n\n"); printf(" AVAILABLIE SANDWICHES\n\n\n"); printf(" Enter the Type of Filling \n 1.Chicken\n 2.Seafood\n 3.Vegetarian\n\n 4.CANCEL \n\n Choice is : "); flushall(); scanf("%d",&fill); switch(fill) { case 1: { printf("\n\nAvailable Chicken Sandwiches are : %d",crem); printf("\n\nPRESS 'ENTER' TO GO BACK"); getch(); return; } case 2: { printf("\n\nAvailable Seafood Sandwiches are : %d",srem); printf("\n\nPRESS 'ENTER' TO GO BACK"); getch(); return; } case 3: { printf("\n\nAvailable Vegetarian Sandwiches are : %d",vrem); printf("\n\nPRESS 'ENTER' TO GO BACK"); getch(); return; } case 4: { return; } default: { printf("\n INVALID CHOICE!!!\n PRESS ANY KEY TO CONTINUE"); getch();
20
} } }while (fill>0||fill<=4); }
21
{ bill[count].subtotal=bill[count].subtotal+100; } if(top==4) { cancelor=1; printf("\nORDER CANCELLED!!! PRESS 'ENTER' TO GO TO MAIN MENU"); getch(); return; } } else { return; } if(temp==3) { return; } temp++; }while(temp<3 && top!=0);
23
24
case 4: { return; } default: { printf("\n INVALID CHOICE!!!\n PRESS ANY KEY TO CONTINUE"); getch(); } } }while (fill>0||fill<=4); }
26
Figure 1: Main Menu Here the three choices are available for selection depending on the function that the user wishes to carry out:
27
Figure 2: New Order - Filling At this point the user will have to get the customers filling requirement, i.e. the type of sandwich he requires. There are three options available for the user to select from. These are Chicken, Seafood and Vegetarian. The user can select any of the above options depending on the customers requirement by pressing either 1, 2or 3 for Chicken, Seafood and Vegetarian respectively. If the user does not wish to continue any further but wishes to return to the Main Menu all he has to do is select 4 and press enter when the system prompts it and the user is returned to the main menu as shown in the image below:
28
Figure 4: New Order - Bread Type Here the user is presented with another three choices to select from; 1 for Baguette, 2 for Foccacia and 3 for Ciabatta. The user is also shown the type of filling that he has selected under the current order section. Once the type of bread that the customer wants has been selected the user must enter the relevant
29
number and press Enter. When this is done the system will move on to the next window.
Figure 5: New Order - Size The user will enter either 1, 2 or three depending on whether the customer wants a size Large or size Medium or size Small respectively. Once the user has entered the customer required size of the sandwich he can press enter and move to the next window or he can choose to cancel the order by pressing 4 and entering it.
30
two or all three toppings. If he at any point wants to end choosing a topping all he has to do is to enter 0 and the system jump to the next window. Given below is how the system will display the options available to the user.
31
Figure 8: New Order - Topping 3 After each of the selection the user is given the choice to stop selecting a topping or the user can simply not have any topping at all.
32
Figure 9: New Order - Quantity Here the system will check if there is sufficient filling to meet that demand. If there is not the following will be displayed and the user will have to enter a new amount depending on what is available:
Figure 10: New Order - Request Unavailable If there is sufficient filling to meet the customers requirements then the system will move on to the next window.
33
34
Figure 12: New Order - Payment Method After this the system will move to the next window. Here depending on whether the customer selected Cash or Credit Card the final Grand Total will vary as a discount will be taken into consideration.
Figure 14: New Order - Credit Payment Bill After this the system will return to the Main Menu.
36
Figure 15: Invalid Entry At this point to recover all the user has to do is to press any key as instructed and the system will take the user back to the point where an input is required.
37
Figure 16: Check Availability After this the system enters to a new window where the user is prompted to enter the type of filling of which the availability is being searched. This can be seen in the image below:
Figure 17: Check Availability Example Here once you enter the type of filling the system will show how many fillings of that particular type is available. After this the user must press enter to return to the Main Menu.
38
6.4 - EXIT
The final option is Exit. If the user selects this option the system will close down. This is to be done once the user has finished working with the system. If he wishes to restart the program the user should follow the instructions given at the beginning of the User Guide.
39
40
8.0 CONCLUSION
The project has been completed successfully within the time frame that was allocated for the system. The project kept with the given specifications that we mentioned in the scope of the project. The team managed to function together with great efficiency where each would cover the others weaknesses and thus helping the whole team to excel and a single unit. We have been able to greatly benefit from the strengths that the other team members processed and thus helping us individually also to excel in the subject. We have been given a chance through this project to ally the theoretical knowledge that we obtained during the class sessions and apply them in a practical sense by doing this assignment.
41
9.0 BIBLIOGRAPHY
Dietel, PJ & HM 2008, How To Programme C, 5th edn, Hall of India (Pvt) Ltd, New Delhi. Saravanan, T 2010, 'Problem Solving and Program Design Using C', LECTURES, School of Computing, Asia Pacific Institute of Information Technology, Asia Pacific Institute of Information Technology, Colombo.
42
I, hereby agree that the above members have undertaken the above tasks and their work is reflective of what I have written above. Group Leader : A.N.Ahamed Nishadh (CB004081) Signature :
43