57
CHAPTER 1:- INTRODUCTION 1.1 PROJECT DESCRIPTION FOOD AUTOMATION” aims at developing into software that can be used at places like restaurants and fastfood poi nts to eas ily man oeuvre the dai ly tas ks of taking the order, calculating the bill etc. The main advantage of this project is that it converts all the manual work which is time consuming and error prone to fully automated system which helps in eliminating all the paper work, saves time, improves customer services. It also speeds up various processes such as addition of new items to the menu, deletion of items from the menu, modification of details of items and calculation of bills thus providing convenience to the workers as well as customers. In the development of the project, selection of an appropriate programming language and a  plat form is of pr imar y import ance. The major pa rt of the cr edit goes to the software environment chosen by the developer. Selection of a language from the ocean of languages is very difficult; a developer has to consider various features and functionalities that a particular language can provide. In this project C++ language is used to maintain all the data. It provides many features like file handling ,data can be easily maintained and many features that are required while doing a  project. 1

Food Automation in Java

Embed Size (px)

Citation preview

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 1/57

CHAPTER 1:- INTRODUCTION

1.1 PROJECT DESCRIPTION

FOOD AUTOMATION” aims at developing into software that can be used at places like

restaurants and fastfood points to easily manoeuvre the daily tasks of taking the order,

calculating the bill etc.

The main advantage of this project is that it converts all the manual work which is time

consuming and error prone to fully automated system which helps in eliminating all the paper 

work, saves time, improves customer services. It also speeds up various processes such as

addition of new items to the menu, deletion of items from the menu, modification of details

of items and calculation of bills thus providing convenience to the workers as well as

customers.

In the development of the project, selection of an appropriate programming language and a

  platform is of primary importance. The major part of the credit goes to the software

environment chosen by the developer. Selection of a language from the ocean of languages is

very difficult; a developer has to consider various features and functionalities that a particular 

language can provide.

In this project C++ language is used to maintain all the data. It provides many features like

file handling ,data can be easily maintained and many features that are required while doing a

 project.

1

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 2/57

1.2 PROBLEM DEFINITION

The project is developed for restaurants, which aims to automate its various tasks. All the

work of various tasks was earlier carried out manually. However in the course of time it was

realized that manual work is error prone and time consuming. Automation provides quick &

easy step by step approach to handle the tasks like adding items to the menu, deleting items ,

modifying the details of items and calculating bills. Thus automation is no longer an option,

it’s a requirement.

1.3 OBJECTIVES OF THE PROPOSED SYSTEM

To reduce time for the organization

To increase efficiency and accuracy of the system

To reduce pressure on the labour and relieving man power from repetitive and dull job

To make the retrieval of information faster 

To make the system more feasible

To reduce large amount of paper work 

To make the system more reliable to avoid any ambiguity.

To reduce the cost factor of the system

To make the system more flexible.

2

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 3/57

1.4 ADVANTAGES OF THE PROPOSED SYSTEM

Converts all the manual work which is time consuming and error prone to fully

automated system

Helps in eliminating all the paper work, saves time and improves customer services.

Makes the addition of items in the menu, deletion of items and modification of items

in the menu easier and faster.

C++ has support for most of the web servers available today

Bills can be calculated more easily and with more accuracy

Reduces pressure on the labour.

Makes the system more feasible and flexible and thus retrieval of information

 becomes convenient

1.5 COMPANY PROFILE

Focustek Manufacturing Services Pvt. Ltd. (FMS), A leading service provider in PCA

assembly, is engaged in SMT & Through Hole technology products with the spirit of 

total customer satisfaction, through its educated & experienced Technical staff.

FMS Pvt. Ltd. is a Korean company. Formally, It was Xo InfoTech and at present, it is

FocusTek Manufacturing Services Pvt. Ltd. FocusTek took Xo InfoTech. Ltd on 20th

  Nov-2006. We are located in Electronic City of Gurgaon, INDIA, which is

advantageously located near International airport. Focustek is a leading innovator in

3

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 4/57

contract manufacturing and has become a value-added contract manufacturing partner 

to the leading OEMs. Our unique blend of high caliber manufacturing services;

flexibility and responsiveness to customer needs; and ability to provide a full range of 

 product testing services have uniquely positioned in the highly-competitive contract

manufacturing marketplace.

Focustek offers quality turn-key assembly solutions for customer electronic products.

We take customer designs and provide low cost alternatives for on-time and quality

 products. We offer several logistic options to meet customer needs. Focustek focuses

on high quality, high efficiency, and customer satisfaction. We also employ SPC and

stringent QC practices to monitor all aspects of production.

1.5.1 COMPANY STRATEGY

They focus on to achieve the customer requirement on time and believe to build the strong

work environment having the key strategies

To Work with customers on Common Goals

Provide Flexibility & Responsiveness.

Deliver On time Quality Products

Hire Best People

Maintain High Standards

Inculcate Right Attitudes & Values

1.5.2 QUALITY POLICY

Self disciplined

Sharing of ideas

4

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 5/57

Fast feedback 

Proper communication

Dedicated to their job

Believes in prevention rather than correction

1.6 INTRODUCTION

C++ is a statically typed, free-form, multi-paradigm, compiled, general-

 purpose programming language. It is regarded as a "middle-level" language, as it comprises a

combination of both high-level and low-level language features. It was developed by Bjarne

Stroustrup starting in 1979 at Bell Labs as an enhancement to the C language and originally

named C with Classes. It was renamed C++ in 1983.

As one of the most popular programming languages ever created, C++ is widely used in the

software industry. Some of its application domains include systems software, application

software, device drivers, embedded software, high-performance server and client

applications, and entertainment software such as video games. Several groups provide both

free and proprietary C++ compiler software, including the GNU

Project, Microsoft, Intel and Borland. C++ has greatly influenced many other popular 

 programming languages, most notably C# and Java.

C++ is also used for hardware design, where design is initially described in C++, then

analyzed, architecturally constrained, and scheduled to create a register transfer 

level hardware description language via high-level synthesis.

The language began as enhancements to C, first adding classes, then virtual

functions, operator overloading, multiple inheritance, templates, and exception

handling among other features.

1.5.1 FEATURES OF C++

5

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 6/57

1.5.1.1 OPERATORS AND OPERATOR OVERLOADING

C++ provides more than 30 operators, covering basic arithmetic, bit manipulation,

indirection, comparisons, logical operations and others. Almost all operators can

 be overloaded for user-defined types, with a few notable exceptions such as member access

(. and .*). The rich set of overloadable operators is central to using C++ as a domain specific

language. The overloadable operators are also an essential part of many advanced C++

 programming techniques, such as smart pointers. Overloading an operator does not change

the precedence of calculations involving the operator, nor does it change the number of 

operands that the operator uses (any operand may however be ignored by the operator,

though it will be evaluated prior to execution). Overloaded "&&" and "||" operators lose

their short-circuit evaluation property.

1.5.1.2 TEMPLATES

C++ templates enable generic programming. C++ supports both function and class templates.

Templates may be parameterized by types, compile-time constants, and other templates. C++

templates are implemented by instantiation  at compile-time. Templates are a powerful tool

that can be used for generic programming, template metaprogramming, and code

optimization, but this power implies a cost. Template use may increase code size, since each

template instantiation produces a copy of the template code: one for each set of template

arguments. Templates are different from macros: while both of these compile-time language

features enable conditional compilation, templates are not restricted to lexical substitution.

Macros are capable of conditional control over compilation based on predetermined criteria,

 but cannot instantiate new types, recurse, or perform type evaluation and in effect are limited

to pre-compilation text-substitution and text-inclusion/exclusion. Macros can control

compilation flow based on pre-defined symbols but cannot, unlike templates, independently

instantiate new symbols.

6

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 7/57

1.5.1.3 OBJECTS

C++ introduces object-oriented (OO) features to C. It offers classes, which provide the four 

features commonly present in OO languages: abstraction, encapsulation, inheritance, 

and  polymorphism. Objects are instances of classes created at runtime. One distinguishing

feature of C++ classes compared to classes in other programming languages is support for 

deterministic destructors, which in turn provide support for Resource Allocation is

Initialization concept.

1.5.1.4 ENCAPSULATION

Encapsulation is the hiding of information in order to ensure that data structures and

operators are used as intended and to make the usage model more obvious to the developer.

C++ provides the ability to define classes and functions as its primary encapsulation

mechanisms.

1.5.1.5 INHERITANCE

Inheritance allows one data type to acquire properties of other data types. Inheritance from a

 base class may be declared as public, protected, or private. Virtual inheritance ensures that

only one instance of a base class exists in the inheritance graph, avoiding some of the

ambiguity problems of multiple inheritance.

1.5.1.6 POLYMORPHISM

Polymorphism enables one common interface for many implementations, and for objects to

act differently under different circumstances. C++ supports several kinds of  static (compile-

time) and dynamic (run-time) polymorphisms. Compile-time polymorphism does not allow

for certain run-time decisions, while run-time polymorphism typically incurs a performance

 penalty.

7

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 8/57

C++ is designed to be a statically typed, general-purpose language that is as efficient

and portable as C

C++ is designed to directly and comprehensively support multiple programming

styles (  procedural programming, data abstraction, object-oriented programming, 

and generic programming)

C++ is designed to give the  programmer choice, even if this makes it possible for the

 programmer to choose incorrectly

C++ is designed to be as compatible with C as possible, therefore providing a smooth

transition from C

C++ avoids features that are platform specific or not general purpose

C++ does not incur overhead for features that are not used (the "zero-overhead

 principle")

C++ is designed to function without a sophisticated programming environment

C++ has certain characteristics over other programming languages. The most remarkable are:

Object-oriented programming

The possibility to orientate programming to objects allows the programmer to design

applications from a point of view more like a communication between objects rather than on

a structured sequence of code. In addition it allows a greater reusability of code in a more

logical and productive way.

Portability

You can practically compile the same C++ code in almost any type of computer and

operating system without making any changes. C++ is the most used and ported

 programming language in the world.

Brevity

8

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 9/57

Code written in C++ is very short in comparison with other languages, since the use of 

special characters is preferred to key words, saving some effort to the programmer (and

 prolonging the life of our keyboards!).

Modular programming

An application's body in C++ can be made up of several source code files that are compiled

separately and then linked together. Saving time since it is not necessary to recompile the

complete application when making a single change but only the file that contains it. In

addition, this characteristic allows to link C++ code with code produced in other languages,

such as Assembler or C.

C Compatibility:

C++ is backwards compatible with the C language. Any code written in C can easily be

included in a C++ program without making any change.

Speed:

The resulting code from a C++ compilation is very efficient, due indeed to its duality as high-

level and low-level language and to the reduced size of the language itself.

CHAPTER 2:- SYSTEM ANALYSIS

2.1 HARDWARE SPECIFICATION

9

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 10/57

• MEMORY : 984 KB

• MICROPROCESSOR: 1.2

• HARD DISK: 40 GB

• PRINTER: HP LASER PRINTER 

2.1 SOFTWARE SPECIFICATION

• PLATFORM : C++ with graphics

• FRONT END: C++

• WINDOWS XP

• M.S WORD

2.3 FEASIBILITY STUDY

This phase is carried out to access whether software project is technically and economically

viable.

It involves following steps:-

Problem is defined

Determination of technical and economical viability

Study of alternative solution to attempt the problem ,a cost/benefit analysis is done.

A layout of plan is prepared to get the project executed, scope of all phases is

determined.

Feasibility is the likelihood that the system will be useful to the organization.

Following feasible factors are studied during feasibility study:-

Economic and financial

10

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 11/57

Technical

Operational

Schedule

Legal and contractual

Political

Organizational

 

Economic or financial feasibility: It is a measure of the cost effectiveness of a project or 

solution underline.

Technical feasibility:-

Its purpose is to gain an understanding of the organizational ability to construct the proposed

system. It is a measure of specific technical solution and availability of technical resources and

expertise.

Operational feasibility:-It is a measure of how well the solution will work in the

organization. It is also a measure of how people feel about the system/project. It is the

willingness and ability of the management, employees, customers, suppliers and others to

operate use and support a proposed system.

Schedule feasibility:-

It is a measure of how responsible the project time-table is.

Legal and contractual feasibility:-

While asserting this we need to gain an understanding of any potential, legal, contractual,

ramifications due to construction of the system.

11

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 12/57

Political feasibility:-

The construction of an IS can have potential ramifications also.

Asserting political feasibility:-

It is a process of evaluating how key stake holders within the organization view the proposed

system.

Organizational feasibility:-

It is the likelihood that the project will attain the desired objective.

2.3 SYSTEM DESIGN

This section of the project involves the division of project in some modules or parts thus

making the presentation of the project clear and easily understandable. We have discussed

 below various modules and part of project they contain.

2.4 MODULES (DESCRIPTION)

This project mainly consists of two menus:

EDIT MENU

MAIN MENU

• EDIT MENU

• ADD ITEM

• DELETE ITEM

12

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 13/57

• MODIFY ITEM

• QUIT

• MAIN MENU

• PURCHASE

• SEE MENU

• EDIT MENU

• TOTAL BILL

• QUIT

ENTER CHOICE

 Now here when we choose the first option i.e. PURCHASE, we need to mention the

item code of the item to be purchased. After this the complete details of the item is

displayed. Then we are required to mention the quantity, whether we want to cancel

this purchase or not

After this total bill is calculated and displayed along with the complete details of 

items.

When we choose the second option i.e. SEE MENU, following details of the list of 

items is displayed:

• ITEM CODE

• ITEM NAME

• ITEM COST

• ITEM PRICE

 Now when we choose the third option EDIT MENU following options are displayed:

• ADD ITEM

• MODIFY ITEM

13

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 14/57

• DELETE ITEM

• EXIT

ENTER CHOICE:

 Now here when we choose the first option i.e. ADD ITEM, we need to specify the

following details of the item:

• ITEM NAME

• ITEM COST

• ITEM PRICE

Thereafter we have to decide whether we want to save the record or not and hence choose

one of the options: y/n. When we choose y our record is saved otherwise not. Then we add

more items according to the requirement.

 Now when we choose the second option i.e. MODIFY ITEM, we need to specify the

item code of the item to be selected and then modify the details of the items as per the

requirement by choosing the correct options.

When we choose the third option i.e. DELETE ITEM, we need to specify the item

code of the item to be deleted. Thereafter the selected item is deleted from the menu.

We can choose the fourth option i.e. EXIT to exit the menu.

14

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 15/57

We can choose the fourth option of the main menu i.e. TOTAL BILL to display the

total bill of the items purchased

15

2. See

menu

1. Purchase

Cancel

the

 purchas

e

List of items

is displayed

with itsdetails such

as item code,

item cost etc

Enter the

item code

and quantity

of the item to

 be purchased

Main menu with the

given available options

is displayed

3 Edit

menu

Edit menu

is displayedwith certain

options

1 add

item

2 delete

item

0 exit

Modify

item

Purchas

e is

cancelle

d

Enter the

item name,

item cost

and item

 price

Enter 

item

code of 

the item

to be

deleted

0 exit

Enter item

code of the

item to be

modified and

change the

details

according to

the

requirementItem is

added

Item is

deletedItem is

modified

Tota

l bill

Total bill

is

calculate

d

Stop

Bill is

calcula

ted

START

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 16/57

FIG 2.1 FLOWCHART

CHAPTER 3 :-IMPLEMENTATION OF THE PROJECT

16

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 17/57

3.1. WORKING OF THE PROJECT

In this project we have three classes:

CLASS MENU

CLASS FOOD

CLASS ACCOUNT

In class menu there are two main functions:

Edit _menu

Main _menu

In case of main menu we have following options:

1 PURCHASE

2 SEE MENU

3 EDIT MENU

4 TOTAL BILL

0 EXIT

In case of purchase we have to mention the item code of the item to be purchased and

quantity. Thereafter bill is displayed. For this we have purchase function

When we choose see menu list of items along with its details such as item code, item cost and

item price is displayed. For this we make use of see menu function

In case of Edit menu we have following options:

ADD ITEM

DELETE ITEM

17

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 18/57

MODIFY ITEM

EXIT

In case of add item we mention the item name, item price and item cost for the item to

 be added and thus the item is added in the menu.

In case of delete item we mention the item code of the item to be deleted.

In case of modify item we mention the item code of the item to be modified.

For this we make use of modify_item and modify_record functions.

When we choose total bill ,total bill is displayed.

In class food we have following functions:

Add_item- This function add records in the food file.

Delete_item – This function gives the code no. to delete record from the food file

Modify_item –This function gives the code no. to modify record from the food file

List_of_item- This function displays the list of food items

Purchase – This function purchases the food item in the menu

Last_code- It returns the code of the last record in the food file.

Delete_record-This function deletes the record for the given code from the food file.

(FOOD.DAT)

Modify_record – This function modify the record for the given code from the food

file

Display_record-It displays the record of the given code from the food

file(FOOD.DAT)

Item_found-This function return the value 1 if the record is found for the given code

in the food file.

18

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 19/57

Recordno- This function return th record no. of the given code in the food file.

Sort- This function sort the record in the food file according to the code nos.

Class account is used to calculate bill.It consists of the following functions:

Bill_list – This function displays the lists of the bills

Prepare_bill – This function prepares and displays the bill for the given bill no.

according to the purchases made.

Last_billno-This function returns the billno. of the last record in the bill file

CHAPTER 4: SNAP SHOTS

19

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 20/57

4.1 OUTPUT OF MAIN PAGE

Fig4.1 Output of main page

20

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 21/57

FIG 4.2 Output obtained by choosing the first option i.e. Purchase

21

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 22/57

4.2 OUTPUT OF PURCHASED ITEM

 

FIG 4.3 After entering the item code of the item to be purchased

22

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 23/57

 

FIG 4.4 Calculated bill is then displayed as shown above

23

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 24/57

4.3 OUTPUT OF EDITING THE MENU

FIG 4.5 Output of editing in the menu

24

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 25/57

FIG 4.6 Output of adding food item to the menu

25

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 26/57

 

FIG 4.7 Output obtained by choosing modify item

26

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 27/57

Fig 4.8 Output obtained after entering the code

27

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 28/57

CHAPTER 4: CONCLUSION

4.1 CONCLUSION

As we all know that a restaurant is a retail establishment that serves prepared food to

customers. Service is generally for eating on premises, though the term has been used to

describe take-out establishments and food delivery services. So this project basically

develops software that can be used at such places to easily man oeuvre the daily tasks of 

taking the order, calculating the bill, modifying the details of the items in the menu etc.

This project is time saving as it saves the time of the workers as well as customers. It

calculates bill quickly and correctly. Modification of the details of the items in the

menu, addition of more items in the menu, deletion of items and keeping up of the

track of the items purchased is much more convenient.

It is also storage saving .Previously all the work was done manually and required a lot

of time. Tedious book-keeping is completely eliminated with automation. Large

amount can be stored in a single hard disk and make it easy for the user to store data

for future retrieval. The storage enhancement provide benefit in the form of cost

saving.

28

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 29/57

Complicated calculations can be done more easily. Thus bills can be prepared more

quickly and with more accuracy just by choosing the correct option which calculates the

 bill automatically.

Optimal utilization of resources can be done. Different tasks of keeping up of the

track of the items in the menu, placing of order and calculating bill can be carried out in

different departments in a systematic way.

4.2 FEATURES OF THE PROJECT

USER-FRIENDLY:

The system will be user –friendly so that it can easily be understand by the user without any

difficulty.

EASY OF MAINTENANCE: 

The system will be easy to maintain and use.

LESS TIME CONSUMING:

The system will be less time consuming, which could have achieved b y good programming.

PORTABILITY:

The system portability will have taken care of without any interventions.

ERROR FREE:

The system will easily handle the user error in any case.

 

29

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 30/57

SOURCE CODE

  #include<iostream.h>

#include<graphics.h>

#include<fstream.h>

#include<process.h>

#include<string.h>

#include<stdlib.h>

#include<stdio.h>

#include<ctype.h>

#include<conio.h>

#include<dos.h>

class menu

{

public:

void main_menu();

private:

 

void edit_menu(void);

};

 

class food

{

public:

void add_item(void);

void delete_item(void);

void modify_item(void);

void list_of_item(void);

void purchase(void);

private:

int last_code(void);

void delete_record(int);

void modify_record(int);

void display_record(int);

int item_found(int);

int recordno(int);

void sort(void);

int itemcode;

char itemname[30];

float itemcost,itemprice;

};

 

class account

{

public:

void bill_list(void);

30

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 31/57

void prepare_bill(int);

int last_billno(void);

void add_bill(int,int

t_itemcode,char *t_itemname,float

t_qty,float t_cost,float t_price);

private:

int code,billno,length;

int dd,mm,yy;

float cost, price,quantity;

char name[30];

};

//THIS FUNCTION CREATES MAIN

MENU AND CALLS OTHER 

FUNCTIONS

void menu::main_menu(void)

{

clrscr();

char ch;

while(1)

{

clrscr();

gotoxy(22,5);

 

cout<<"---------------------------------------";

gotoxy(35,6);

cout<<"FAST FOOD";

gotoxy(22,7);

 

cout<<"---------------------------------------";

gotoxy(32,9);

cout<<"1: Purchase";

gotoxy(32,11);

cout<<"2: See menu";

gotoxy(32,13);

cout<<"3: Edit menu";

gotoxy(32,15);

cout<<"4: Total bill";

gotoxy(32,17);

cout<<"0: Quit";

gotoxy(32,20);

cout<<"enter choice:";

ch=getche();

if(ch==27)

return;

else

if(ch=='1')

{

food f;

f.purchase();

31

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 32/57

}

else

if(ch=='2')

{

food f;

f.list_of_item();

}

else

if(ch=='3')

edit_menu();

else

if(ch=='4')

{

account a;

a.bill_list();

}

else

if(ch=='0')

break;

}

}

 

//THIS FUNCTION CREATE

EDIT MENU AND CALLS

OTHER //FUNCTIONS

void menu::edit_menu()

{

clrscr();

char ch;

while(1)

{

for(int i=5;i<=21;i++)

{

gotoxy(21,i);

cout<<" ";

}

gotoxy(32,6);

cout<<"edit menu";

gotoxy(32,7);

 

cout<<"~~~~~~~~~~~~~~~~~~~~~";

gotoxy(32,10);

cout<<"1:add item";

gotoxy(32,12);

cout<<"2:modify item";

gotoxy(32,14);

32

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 33/57

cout<<"3:delete item";

gotoxy(32,16);

cout<<"0:exit";

gotoxy(32,19);

cout<<"enter choice:";

ch=getche();

if(ch==27)

return;

else

if(ch=='1')

{

food f;

f.add_item();

break;

}

else

if(ch=='2')

{

food f;

f.modify_item();

break;

}

else

if(ch=='3')

{

food f;

f.delete_item();

break;

}

else

if(ch=='0')

break;

}

}

//THIS FUNCTION RETURNS

THE CODE OF THE LAST

RECORD IN //THE FOOD

FILE (FOOD.DAT)

int food::last_code(void)

{

fstream file;

file.open("FOOD.DAT",ios::in);

file.seekg(0,ios::beg);

int t=0;

 

while(file.read((char*)this,sizeof(food)))

t=itemcode;

file.close();

33

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 34/57

return t;

}

//THIS FUNCTION DISPLAYS

LIST OF THE FOOD ITEMS

void food::list_of_item()

{

clrscr();

fstream file;

file.open("FOOD.DAT",ios::in);

file.seekg(0);

int row=6,found=0,pageno=1;

gotoxy(30,2);

cout<<"LIST OF ITEMS";

gotoxy(29,3);

cout<<"~~~~~~~~~~~~~~~~~";

gotoxy(3,4);

cout<<"ITEM CODE ITEM

  NAME ITEM COST ITEM PRICE";

gotoxy(2,5);

 

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~`";

 

while(file.read((char*)this,sizeof(food)))

{

delay(20);

found=1;

gotoxy(5,row);

cout<<itemcode;

gotoxy(14,row);

cout<<itemname;

gotoxy(32,row);

cout<<itemcost;

gotoxy(45,row);

cout<<itemprice;

if(row==22)

{

row=5;

gotoxy(66,1);

cout<<"Pageno:"<<pageno;

gotoxy(66,2);

cout<<"=======";

pageno++;

gotoxy(1,25);

cout<<"Press any key to

continue";

getche();

clrscr();

gotoxy(30,2);

34

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 35/57

cout<<"LIST OF ITEMS";

gotoxy(3,4);

cout<<"ITEM CODE ITEM

  NAME ITEM COST ITEM COST";

gotoxy(2,5);

 

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~

~";

}

else

row++;

}

if(!found)

{

gotoxy(5,10);

cout<<"\7Records not found";

}

gotoxy(66,1);

cout<<"page no:"<<pageno;

gotoxy(66,2);

cout<<"===========";

gotoxy(1,25);

cout<<"Press any key to

continue...";

getche();

file.close();

}

//THIS FUNCTION ADDS

RECORDS IN THE FOOD FILE

(FOOD.DAT)

void food::add_item(void)

{

int tcode,valid;

char 

ch,t_itemcost[10],t_itemprice[10];

tcode=last_code();

tcode++;

do

{

clrscr();

gotoxy(71,2);

cout<<"<0>=EXIT";

gotoxy(27,3);

cout<<"ADD FOOD ITEM TO

THE MENU";

gotoxy(26,4);

 

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~"

;

35

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 36/57

gotoxy(5,6);

cout<<"Itemcode:"<<tcode;

gotoxy(5,8);

cout<<"Item name:";

gotoxy(5,10);

cout<<"Item cost:";

gotoxy(5,12);

cout<<"Item price:";

do

{

valid=1;

gotoxy(1,8);clreol();

gotoxy(1,24);clreol();

gotoxy(1,25);clreol();

gotoxy(3,25);

cout<<"ENTER ITEM NAME

TO ADD IN THE MENU";

gotoxy(5,8);

cout<<"Item Name:";

gets(itemname);

strupr(itemname);

if(itemname[0]=='0')

return;

if((strlen(itemname)<1)||

(strlen(itemname)>20))

{

valid=0;

gotoxy(3,24);

cout<<"\7range=1.20";

getch();

}

}while(!valid);

do

{

valid=1;

gotoxy(1,10);clreol();

gotoxy(1,24);clreol();

gotoxy(1,25);clreol();

gotoxy(3,25);

cout<<"ENTER ITEM COST

TO ADD IN THE MENU";

gotoxy(5,10);

cout<<"Item cost:";

gets(t_itemcost);

itemcost=atof(t_itemcost);

if(t_itemcost[0]=='0')

return;

if(itemcost<1||itemcost>800)

{

valid=0;

36

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 37/57

gotoxy(3,24);

cout<<"\7Range=1.800";

getch();

}

}while(!valid);

do

{

valid=1;

gotoxy(1,12);clreol();

gotoxy(1,24);clreol();

gotoxy(1,25);clreol();

gotoxy(3,25);

cout<<"ENTER ITEM PRICE

TO ADD IN THE MENU";

gotoxy(5,12);

cout<<"Item price:";

gets(t_itemprice);

itemprice=atof(t_itemprice);

if(t_itemprice[0]=='0')

return;

if(itemprice<itemcost||

itemprice>1000)

{

valid=0;

gotoxy(3,24);

 

cout<<"\7Range="<<itemcost<<"...1000";

getch();

}

}while(!valid);

do

{

gotoxy(1,15);clreol();

gotoxy(1,24);clreol();

gotoxy(1,25);clreol();

gotoxy(5,15);

cout<<"do you want to save this

record(y/n):";

ch=getche();

ch=toupper(ch);

if(ch=='0')

return;

}while(ch!='N'&&ch!='Y');

if(ch=='Y')

{

itemcode=tcode;

fstream file;

file.open("FOOD.DAT",ios::out|

ios::app);

37

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 38/57

 

file.write((char*)this,sizeof(food));

file.close();

tcode++;

}

do

{

gotoxy(1,17);clreol();

gotoxy(1,24);clreol();

gotoxy(1,25);clreol();

gotoxy(5,17);

cout<<"DO YOU WANT TO

ADD MORE RECORDS(y/n):";

ch=getche();

ch=toupper(ch);

if(ch=='0')

return;

}while(ch!='N'&&ch!='Y');

}while(ch=='Y');

}

//THIS FUNCTION DISPLAYS

THE RECORD OF THE GIVEN

CODE FROM //THE FOOD FILE

(FOOD.DAT)

void food::display_record(int

tcode)

{

fstream file;

file.open("FOOD.DAT",ios::in);

file.seekg(0,ios::beg);

while(file.read((char*)this,sizeof(food)))

{

if(itemcode==tcode)

{

gotoxy(5,3);

cout<<"Item Code:"<<itemcode;

gotoxy(5,4);

cout<<"Item

 Name:"<<itemname;

gotoxy(5,5);

cout<<"Item Cost:"<<itemcost;

gotoxy(5,6);

cout<<"Item Price:"<<itemprice;

 break;

}

}

38

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 39/57

file.close();

}

//THIS FUNCTION RETURNS

THE VALUE 1 IF THE RECORD

IS FOUND //FOR THE GIVEN

CODE IN THE FOOD FILE

(FOOD.DAT)

int food::item_found(int tcode)

{

fstream file;

file.open("FOOD.DAT",ios::in);

file.seekg(0,ios::beg);

int found=0;

while(file.read((char*)this,sizeof(food)))

{

if(itemcode==tcode)

{

found++;

 break;

}

}

file.close();

return found;

}

//THIS FUNCTION RETURN

THE RECORD NO.OF THE

GIVEN CODE IN //THE FOOD

FILE (FOOD.DAT)

int food::recordno(int tcode)

{

fstream file;

file.open("FOOD.DAT",ios::in);

file.seekg(0,ios::beg);

int found=0;

while(file.read((char*)this,sizeof(food)))

{

found++;

if(itemcode==tcode)

 break;

}

file.close();

return found;

}

39

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 40/57

//THIS FUNCTION DELETES

THE RECORD FOR THE GIVEN

CODE FROM //THE FOOD FILE

( FOOD.DAT)

void food::delete_record(int

tcode)

{

fstream file;

file.open ("FOOD.DAT",ios::in);

fstream temp;

temp.open("temp.dat",ios::out);

file.seekg(0,ios::beg);

while(!file.eof())

{

file.read((char*)this,sizeof(food));

if(file.eof())

 break;

if(itemcode!=tcode)

temp.write((char*)this,sizeof(food));

}

file.close();

temp.close();

file.open("FOOD.DAT",ios::out);

temp.open("temp.dat",ios::in);

temp.seekg(0,ios::beg);

while(!temp.eof())

{

temp.read((char*)this,sizeof(food));

if(temp.eof())

 break;

file.write((char*)this,sizeof(food));

}

file.close();

temp.close();

}

//THIS FUNCTION GIVES THE

CODE NO. TO DELETE THE

RECORD //FROM THE FOOD

FILE (FOOD.DAT)

40

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 41/57

void food::delete_item()

{

clrscr();

char t_code[5],ch;

int t,tcode;

gotoxy(3,25);

cout<<"Press<ENTER>to see the

list";

gotoxy(5,3);

cout<<"Enter Item code of the

item to be deleted:";

gets(t_code);

t=atoi(t_code);

tcode=t;

if(t_code[0]=='0')

return;

if(tcode==0)

{

list_of_item();

gotoxy(1,25);

clreol();

gotoxy(3,25);

cout<<"Press<ENTER> to Exit";

gotoxy(5,24);

cout<<"Enter Item Code of the

item to be deleted:";

gets(t_code);

t=atoi(t_code);

tcode=t;

if(tcode==0)

return;

}

clrscr();

if(!item_found(tcode))

{

gotoxy(5,5);

cout<<"\7record not found";

getch();

return;

}

display_record(tcode);

do

{

gotoxy(1,8);

clreol();

gotoxy(5,8);

cout<<"Do you want to delete

this record (y/n):";

41

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 42/57

ch=getche();

ch=toupper(ch);

}

while(ch!='N'&&ch!='Y');

if(ch=='N')

return;

delete_record(tcode);

gotoxy(5,15);

cout<<"\7Record Deleted";

getch();

}

//THIS FUNCTION MODIFY

THE RECORD FOR THE GIVEN

CODE FROM //THE FOOD FILE

(FOOD.DAT)

void food::modify_record(int

tcode)

{

int recno;

recno=recordno(tcode);

int valid,t_code;

char 

ch,t_itemcost[10],t_itemprice[10],t_itemco

de[5];

gotoxy(71,2);

cout<<"<0>=Exit";

gotoxy(5,12);

cout<<"Item Code:";

gotoxy(5,14);

cout<<"Item Name:";

gotoxy(5,16);

cout<<"Item Cost:";

gotoxy(5,18);

cout<<"Item Price:";

do

{

gotoxy(20,12);clreol();

cout<<"Change(y/n):";

ch=getche();

ch=toupper(ch);

if(ch=='0')

return;

}

while(ch!='N'&&ch!='Y');

valid=0;

while(ch=='Y'&&!valid)

42

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 43/57

{

valid=1;

gotoxy(1,12);clreol();

gotoxy(1,24);clreol();

gotoxy(1,25);clreol();

gotoxy(3,25);

cout<<"ENTER ITEM CODE

TO ADD IN THE MENU";

gotoxy(5,12);

cout<<"Item Code";

gets(t_itemcode);

t_code=atoi(t_itemcode);

if(t_code==0)

return;

if(item_found(t_code)&&(t_code!=tcode))

{

valid=0;

gotoxy(3,24);

cout<<"\7CODE ALREADY

GIVEN";

getch();

}

}

do

{

gotoxy(20,14);

clreol();

cout<<"Change(y/n):";

ch=getche();

ch=toupper(ch);

if(ch=='0')

return;

}

while(ch!='N'&&ch!='Y');

valid=0;

while(ch=='Y'&&!valid)

{

valid=1;

gotoxy(1,14);clreol();

gotoxy(1,24);clreol();

gotoxy(1,25);clreol();

gotoxy(3,25);

cout<<"ENTER ITEM NAME

TO ADD IN THE MENU:";

gotoxy(5,14);

cout<<"Item Name:";

gets(itemname);

43

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 44/57

strupr(itemname);

if(itemname[0]=='0')

return;

if((strlen(itemname)<1)||

(strlen(itemname)>20))

{

valid=0;

gotoxy(3,24);

cout<<"\7Range=1.20";

getch();

}

}

do

{

gotoxy(20,16);

clreol();

cout<<"change(y/n):";

ch=getche();

ch=toupper(ch);

if(ch=='0')

return;

}

while(ch!='N'&&ch!='Y');

valid=0;

while(ch!='N'&&!valid)

{

valid=1;

gotoxy(1,16);

clreol();

gotoxy(1,24);clreol();

gotoxy(1,25);clreol();

gotoxy(3,25);

cout<<"ENTER ITEM COST

TO ADD IN THE MENU";

gotoxy(5,16);

cout<<"Item Cost:";

gets(t_itemcost);

itemcost=atof(t_itemcost);

if(t_itemcost[0]=='0')

return;

if(itemcost<1||itemcost>800)

{

valid=0;

gotoxy(3,24);

cout<<"\7Range=1.800";

getch();

}

}

do

44

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 45/57

{

gotoxy(20,18);

clreol();

cout<<"change(y/n):";

ch=getche();

ch=toupper(ch);

if(ch=='0')

return;

}

while(ch!='N'&&ch!

='Y');valid=0;

while(ch=='Y'&&!valid)

{

valid=1;

gotoxy(1,18);clreol();

gotoxy(1,24);clreol();

gotoxy(1,25);clreol();

gotoxy(3,25);

cout<<"ENTER ITEM PRICE

TO ADD IN THE MENU";

gotoxy(5,18);

cout<<"Item Price";

gets(t_itemprice);

itemprice=atof(t_itemprice);

if(t_itemprice[0]=='0')

return;

if(itemprice<itemcost||

itemprice>1000)

{

valid=0;

gotoxy(3,24);

cout<<"\7Range="<<itemcost<<"....1000";

getch();

}

}

do

{

gotoxy(1,21);clreol();

gotoxy(1,24);clreol();

gotoxy(1,25);

clreol();

gotoxy(5,21);

cout<<"Do you want to save this

record(y/n):";

ch=getche();

ch=toupper(ch);

if(ch=='0')

return;

}while(ch!='N'&&ch!='Y');

45

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 46/57

if(ch=='N'&&ch!='Y');

if(ch=='N')

return;

itemcode=t_code;

getch();

fstream file;

file.open("FOOD.DAT",ios::out|

ios::ate);

int location;

location=(recno-1)*sizeof(food);

file.seekp(location);

file.write((char*)this,sizeof(food));

file.close();

sort();clrscr();

gotoxy(5,15);

cout<<"\7Record Modified";

getch();

}

//THIS FUNCTION GIVES THE

CODE NO. TO MODIFY

RECORD FROM //THE FOOD

FILE (FOOD.DAT)

void food::modify_item()

{

clrscr();

char t_code[5],ch;

int t,tcode;

gotoxy(3,25);

cout<<"Press <ENTER> to see

the list";

gotoxy(5,3);

cout<<"Enter Item code of the

item to be modify:";

gets(t_code);

t=atoi(t_code);

tcode=t;

if(t_code[0]=='0')

return;

if(tcode==0)

{

list_of_item();

gotoxy(1,25);clreol();

gotoxy(3,25);

cout<<"Press <ENTER> to

Exit";

46

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 47/57

gotoxy(5,24);

cout<<"Enter Item Code of the

item to be modified:";

gets(t_code);

t=atoi(t_code);

tcode=t;

if(tcode==0)

return;

}

clrscr();

if(!item_found(tcode))

{

gotoxy(5,5);

cout<<"\7Record not found";

getch();

return;

}

display_record(tcode);

do

{

gotoxy(1,8);clreol();

gotoxy(5,8);

cout<<"Do you want to Modify

this record(y/n):";

ch=getche();

ch=toupper(ch);

}while(ch!='N'&&ch!='Y');

if(ch=='N')

return;

modify_record(tcode);

}

//THIS FUNCTION SORT THE

RECORD IN THE FOOD FILE

(FOOD.DAT) //ACCORDING TO

THE CODE NOS.

void food::sort()

{

int i=0,j=0

;

food arr[100];

food temp;

fstream file;

file.open("FOOD.DAT",ios::in);

file.seekg(0,ios::beg);

while(file.read((char*)&arr[i],sizeof(food)

))

47

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 48/57

i++;

int size;

size=i;

file.close();

for(i=1;i<size;i++)

for(j=0;j<size-i;j++)

{

if(arr[j].itemcode>arr[j+1].itemcode)

{

temp=arr[j];

arr[j]=arr[j+1];

arr[j+1]=temp;

}

}

file.open("FOOD.DAT",ios::out);

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

file.write((char*)&arr[i],sizeof(food));

file.close();

}

//THIS FUNCTION

PURCHASES THE FOOD ITEM IN THE

MENU

void food::purchase()

{

clrscr();

account a;

int t_billno,purchased=0;

t_billno=a.last_billno();

t_billno++;

char t_code[5],ch,t_quantity[5];

int t,tcode,i=0,valid;

float qty;

int t_itemcode;

float t_qty,t_cost,t_price;

char t_itemname[30];

struct date d;

int d1,m1,y1;

getdate(&d);

d1=d.da_day;

m1=d.da_mon;

y1=d.da_year;

do

{

clrscr();

gotoxy(3,25);

48

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 49/57

cout<<"Press <ENTER>to see

the list";

gotoxy(5,3);

cout<<"Enter Item Code of the

item to be purchased:";

gets(t_code);

t=atoi(t_code);

tcode=t;

if(t_code[0]=='0')

{

if(purchased)

a.prepare_bill(t_billno);

return;

}

if(tcode==0)

{

list_of_item();

gotoxy(1,25);clreol();

gotoxy(5,24);

cout<<"Enter Item Code of the

item to be purchased:";

gets(t_code);

t=atoi(t_code);

tcode=t;

if(tcode==0)

{

if(purchased)

a.prepare_bill(t_billno);

return;

}

}

clrscr();

if(!item_found(tcode))

{

gotoxy(5,5);

cout<<"\7Item Code not found";

getch();

if(purchased)

a.prepare_bill(t_billno);

return;

}

gotoxy(60,2);

cout<<"Date:"<<d1<<"/"<<m1<<"/"<<y1;

display_record(tcode);

do

{

valid=1;

gotoxy(1,8);clreol();

gotoxy(1,24);clreol();

49

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 50/57

gotoxy(1,25);clreol();

gotoxy(3,25);

cout<<"ENTER QUANTITY TO

BE PURCHASED IN Kg";

gotoxy(5,8);

cout<<"Quantity:";

gets(t_quantity);

qty=atoi(t_quantity);

if(t_quantity[0]=='0')

{

if(purchased)

a.prepare_bill(t_billno);

return;

}

if(qty<1||qty>800)

{

valid=0;

gotoxy(3,24);

cout<<"\7Range=1..800";

getch();

}

}while(!valid);

do

{

gotoxy(5,10);clreol();

gotoxy(5,10);

cout<<"Do You want to cancel

this purchase(y/n):";

ch=getche();

ch=toupper(ch);

}

while(ch!='N'&&ch!='Y');

if(ch=='N')

{

 purchased=1;

fstream file;

file.open("FOOd.DAT",ios::in);

file.seekg(0,ios::beg);

while(file.read((char*)this,sizeof(food)))

{

if(itemcode==tcode)

{

t_itemcode=itemcode;

strcpy(t_itemname,itemname);

t_cost=itemcost;

t_price=itemprice;

t_qty=qty;

50

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 51/57

a.add_bill(t_billno,t_itemcode,t_itemname

,t_qty,t_cost,t_price);

i++;

 break;

}

}

file.close();

}

do

{

gotoxy(5,12);

clreol();

gotoxy(5,12);

cout<<"Do you want to purchase

more (y/n):";

ch=getche();

ch=toupper(ch);

}

while(ch!='N'&&ch!='Y');

}

while(ch=='Y');

a.prepare_bill(t_billno);

}

//THIS FUNCTION RETURNS

THE BILL NO. OF THE LAST

RECORD IN //THE BILL

FILE(BILL.DAT)

 

int account::last_billno()

{

fstream file;

file.open("BILL.DAT",ios::in);

file.seekg(0,ios::beg);

int t=0;

while(file.read((char*)this,sizeof(account))

)

t=billno;

file.close();

return t;

}

//THIS FUNCTION ADDS THE

RECORD IN THE BILL FILE

(BILL.DAT)

51

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 52/57

void account::add_bill(int

t_billno,int t_itemcode,char 

t_itemname[30],float t_qty,float

t_cost,float t_price)

{

struct date d;

int d1,m1,y1;

getdate(&d);

d1=d.da_day;

m1=d.da_mon;

y1=d.da_year;

dd=d1;

mm=m1;

yy=y1;

code=t_itemcode;

strcpy(name,t_itemname);

cost=t_cost;

 price=t_price;

quantity=t_qty;

 billno=t_billno;

fstream file;

file.open("BILL.DAT",ios::out|

ios::app);

file.write((char*)this,sizeof(account));

file.close();

}

//THIS FUNCTION PREPARES

AND DISPLAYS THE BILL FOR 

THE //GIVEN BILL NO.

ACCORDING TO PURCHASES

MADE

void account::prepare_bill(int

t_billno)

{

clrscr();

struct date d;

int d1,m1,y1;

getdate(&d);

d1=d.da_day;

m1=d.da_mon;

y1=d.da_year;

int total,total_bill=0;

gotoxy(33,3);

cout<<"CUSTOMER BILL";

gotoxy(32,4);

52

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 53/57

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~";

gotoxy(55,5);

cout<<"Date:"<<d1<<"/"<<m1<<"/"<<y1;

gotoxy(8,7);

cout<<"ITEMS PURCHASED";

gotoxy(8,8);

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~";

gotoxy(8,9);

cout<<"Item code Item name

Cost price Qty Total";

gotoxy(8,10);

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`";

int row=11;

fstream file;

file.open("BILL.DAT",ios::in);

file.seekg(0);

while(file.read((char*)this,sizeof(account))

)

{

if(billno==t_billno)

{

gotoxy(8,5);

cout<<"BILL NO #"<<billno;

gotoxy(8,6);

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~";

gotoxy(10,row);

cout<<code;

gotoxy(18,row);

cout<<name;

gotoxy(39,row);

cout<<cost;

gotoxy(47,row);

cout<<price;

gotoxy(56,row);

cout<<quantity;

total=quantity*price;

gotoxy(63,row);

cout<<total;

total_bill=total_bill+total;

53

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 54/57

row++;

}

}

file.close();

gotoxy(39,row+1);

cout<<"TOTAL BILL:

Rs."<<total_bill<<"/=";

getch();

}

//THIS FUNCTION DISPLAYS

THE LIST OF THE BILLS

void account::bill_list(void)

{

clrscr();

fstream file;

file.open("BILL.DAT",ios::in);

file.seekg(0);

int

row=5,found=0,pageno=1,prev_billno=0,fl

ag=0;

float total=0.0,total_bill=0.0;

gotoxy(30,2);

cout<<"LIST OF BILLS";

gotoxy(29,3);

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~";

gotoxy(3,4);

cout<<"Billno.Date Item code

Item name Cost price qty Total";

gotoxy(3,5);

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~`";

while(file.read((char*)this,sizeof(account))

)

{

row++;

delay(20);

found=1;

if(prev_billno!=billno)

{

if(flag)

{

total=quantity*price;

54

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 55/57

gotoxy(52,row);

total_bill=total_bill+total;

cout<<"TOTAL

BILL:Rs"<<total_bill<<"/=";

row++;

}

gotoxy(4,row);

cout<<billno;

}

flag=1;

gotoxy(11,row);

cout<<dd<<"/"<<mm<<"/"<<yy;

gotoxy(24,row);

cout<<code;

gotoxy(32,row);

cout<<name;

gotoxy(42,row);

cout<<cost;

gotoxy(52,row);

cout<<price;

gotoxy(61,row);

 prev_billno=billno;

}

row++;

gotoxy(71,row);

float total_2=0.0;

total_2=total_2+total_bill;

row++;

cout<<"TOTAL

BILL:Rs."<<total_2<<"/=";

if(!found)

{

gotoxy(5,10);

cout<<"\7Records not found";

}

gotoxy(66,1);

cout<<"Page no.:"<<pageno;

gotoxy(1,25);

cout<<"Press any key to

continue....";

getche();

file.close();

}

void gra()

{

clrscr();

55

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 56/57

int gmode,errorcode;int

gd=DETECT,gm;

initgraph(&gd,&gm,"d:\\tc\\bgi");

setcolor(8);

ellipse(320,240,0,360,300,150);

settextstyle(10,0,3);

settextjustify(1,1);

setcolor(5);

outtextxy(320,170,"FASTFOOD

AUTOMATION");

delay(250);

settextstyle(4,0,4);

setcolor(20);

outtextxy(320,220,"MADE

BY");

delay(250);

outtextxy(320,315,"");

settextstyle(10,0,1);

setcolor(3);

delay(250);

outtextxy(320,265,"KAPIL");

for(int stangle=0;!

kbhit();stangle++)

{

setcolor(7);

ellipse(320,240,stangle,stangle+20,300,15

0);

ellipse(320,240,stangle+180,stangle+200,3

00,150);

delay(9);

setcolor(8);

ellipse(320,240,stangle-

1,stangle+19,300,150);

ellipse(320,240,stangle-

1+180,stangle+199,300,150);

}

closegraph();

}

//THIS FUNCTION IS THE

MAIN FUNCTION CALLING

THE MAIN //MENU

void main()

{

clrscr();

gra();

56

8/3/2019 Food Automation in Java

http://slidepdf.com/reader/full/food-automation-in-java 57/57

menu m;

m.main_menu();

}

BIBLOGRAPHY

Computer Science with C++ by Sumitra Arora,

Object Oriented Programming in C++ by Robert Lafore

Object Oriented Programming in C++ by E.Balagruswamy

 A book on Computer graphics by Pouline Baker

www.w3schools.com

www.tizag.com

www.haneng.com

www.google.com