Vous êtes sur la page 1sur 76

GOVERNMENT COLLEGE, KARIAVATTOM 1 MOBILESHOP MANAGEMENT SYSTEM

UNIVERSITY OF KERALA

INSTITUTE OF DISTANCE EDUCATION

KARIAVATTOM, THIRUVANANTHAPURAM

MOBILESHOP MANAGEMENT SYSTEM

Submitted by
SABU M
(90031)

BCA II

DEPARTMENT OF COMPUTER SCIENCE

(2014-2015)

DEPARTMENT OF COMPUTER SCIENCE Page 1


GOVERNMENT COLLEGE, KARIAVATTOM 2

UNIVERSITY OF KERALA
INSTITUTE OF DISTANCE EDUCATION

KARIAVATTOM, THIRUVANANTHAPURAM

CERTIFICATE

This is to certify that the report on “MOBILESHOP


MAMAGEMET SYSTEM” is a bonafied record of the work done by
SABU M(Reg.No.90031) under my supervision and guidance towards
the partial fulfilment of requirement for the award of the BCA,
University of Kerala during this academic year 2014-2015

External Examiner Lecturer in charge Co-Ordinator

Mr. Kumaresan Mrs. Vidya


(Dept of Computer Science) (Dept of Computer Science)

DEPARTMENT OF COMPUTER SCIENCE Page 2


GOVERNMENT COLLEGE, KARIAVATTOM 3 PERIODIC TABLE

Acknowledgement

I extend our sincere gratitude to our computer lecteror, Mr.


Kumaresan for this very much valuable guidance and timely instructions
rendered to us for the completion of this venture, without which it would not
have been a success.
I am also thank our lab assistant for her services and help
offered in the lab. I also thank Mrs. Vidya, Co-Ordinator of the Department of
Computer Science, for her interest in the completion of the work.
Last but not the least, we wish to thank our parents, our
friends and the almighty for helping us to complete our project work successfully.

SABU M

DEPARTMENT OF COMPUTER SCIENCE Page 3


GOVERNMENT COLLEGE, KARIAVATTOM 4 PERIODIC TABLE

Table of Contents
1. Introduction
2. System study
2.1. Existing System
2.2. Proposed System
3. System Requirements
3.1. Software Requirements
3.2. Hardware Requirements
4. System Analysis
4.1. Feasibility Study
4.1.1. Economic & Technical Feasibility
4.1.2. Social & Behavioral Feasibility
5. System Design
5.1. Input Design
5.2. Output Design
5.3. Interface Design
5.4. Procedural Design
5.5. File Design
5.6. Data Flow Design
6. Implementation and Testing
6.1. System Testing
7. Conclusion

DEPARTMENT OF COMPUTER SCIENCE Page 4


GOVERNMENT COLLEGE, KARIAVATTOM 5 PERIODIC TABLE

1.INTRODUCTION

The Mobile Store Management System is one can go into almost required solution
regarding the Mobile store. This software package provides guidance for all the mobile shop
purpose, as a perfect guide, the current demand for such software became needful. This project
will provide for computerization of a small enterprise whose main goal is to keep track on their
inventory and billing process and wants to change from paper based transaction to computerized
transaction.

The mobile store management will make storing of the stock records, employee records,
purchase information, and customer information a lot easier. The supplier and sales information
in the database will automatically generate bills when the customer buys the mobile. The bill
history can be retrieved promptly. And reports will be generated based on different criteria’s.

The product could be implemented in an average sized organization, which will not be very keen
on spending loads of money on ledgers. Whereas our product will greatly reduce the running by
using common and cheap office items like database and desktop application. And also there is no
requirement to store books or accounts. The data is directly stored in the database in the hard
disk of the PC.

Every programming language has advantages and disadvantages; familiar with


the C++ programming language and learning a new language was beyond the scope of this
project, I chose to work within the C++ language. A few advantages with choosing this language
are that the code is easily transferred into other programming languages and that it is universally
known. I choose to use a Windows Console application due to its simplicity and my familiarity
with it.

DEPARTMENT OF COMPUTER SCIENCE Page 5


GOVERNMENT COLLEGE, KARIAVATTOM 6 PERIODIC TABLE

2. SYSTEM STUDY
2.1. EXISTING SYSTEM:

System Analysis is a detailed study of the various operations performed by a system and their

relationships within and outside of the system. Here the key question is- what all problems

exist in the present system? What must be done to solve the problem? Analysis begins when

a user or manager begins a study of the program using existing system. During analysis, data

collected on the various files, decision points and transactions handled by the present system.

The commonly used tools in the system are Data Flow Diagram, interviews, etc. Training,

experience and common sense are required for collection of relevant information needed to

develop the system. The success of the system depends largely on how clearly the problem is

defined, thoroughly investigated and properly carried out through the choice of solution. A

good analysis model should provide not only the mechanisms of problem understanding but

also the frame work of the solution. Thus it should be studied thoroughly by collecting data
about

the system. Then the proposed system should be analyzed thoroughly in accordance with the
needs.

System analysis can be categorized into four parts.

1 System planning and initial investigation

2 Information Gathering

3 Applying analysis tools for structured analysis

If you have to get information regarding any elements of periodic table


then you have to use either period table which is made of paper or if you are going to use any
software then you have to wait to download that particular software. Sometimes you get irritated,
because the downloaded software are not getting the exact information as per your requirement.
In the existing system, users do not get details of all elements which are available in the periodic

DEPARTMENT OF COMPUTER SCIENCE Page 6


GOVERNMENT COLLEGE, KARIAVATTOM 7 PERIODIC TABLE

table till date. Under the existing system all elements are not available under the same screen and
you have to press next button or previous button to get details of your desired elements. All
elements are not easily visible clearly so you have to scroll down the screen to get the entire
information. There is no any simple way to quit the program and some program takes more disk
space just for getting few information on time.

2.2. PROPOSED SYSTEM

As this program in written in C++, so it will take a little amount of your disk space and memory
to load and execute the program. You do not have to download any software to get the details of
elements which are available under the periodic table. You have to just use the codes which are
given for this program and run over your computer. When you will press any key, you will be
taken to the main screen of period table section.

You can click any key to go to the next section. Under the next screen, you will be
provided with all the elements list on the same screen and it will be displayed in same way which
is displayed over periodic table chart map.

To get details, you have to select particular element and press enter. Once you press enter
you will able to get all its details. Whenever you want to quit the program, you have to just press
ESC key from your keyboard and program will be terminated automatically.

The system is very simple in design and to implement. The system requires very low
system resources and the system will work in almost all configurations.

Advantages of proposed System

 It will platform independent


 It will be User friendly
 Error handling will be done properly
 Save Time and money
 Generate Report

All the manual difficulties in managing ing this system have been rectified by
implementing computerization.

DEPARTMENT OF COMPUTER SCIENCE Page 7


GOVERNMENT COLLEGE, KARIAVATTOM 8 PERIODIC TABLE

User level

The Periodic Table system code was built and manipulated in the CPP programming
language. Which is one of the more High-level programming language. CPP is used because
the Periodic Table management system barely has any memory. Typically, in embedded
systems, it is better to use languages that do not have a large memory footprint. Once a
knowledge of the fundamentals of CPP was attained and the first project was finished, there
was a new attempt to gain a better understanding of the hardware , especially that of the
keyboard .

2.3 PACKAGE SELECTION

Windows XP,7 is a line of operating systems developed by Microsoft for use on


general purpose computer systems, including home and business desktops, notebook computers
and media centers. The letters ‘XP’ stand for experience. Windows XP is the successor to both
Windows 2000 and Windows Me and is first consumer oriented operating system produced by
Microsoft to be built on the Windows NT kernel and architecture.

The most common editions of operating systems are Windows XP home edition,
which is targeted at home users, and Windows XP professional, which has additional features
such as, support for Windows server domain and two physical processors and is targeted at
power users and business clients. Windows XP Tablet PC edition is designed to run the ink-
aware Tablet PC platform. Two separate 64 bit versions of Windows XP were also released,
Windows XP 64 bit edition for IA-64(Itanium) processors and Windows XP Professional x64
edition for x86-64 processors.

DEPARTMENT OF COMPUTER SCIENCE Page 8


GOVERNMENT COLLEGE, KARIAVATTOM 9 PERIODIC TABLE

2.4 RESOURCES REQUIRED


Development resource contains Human Resources and Environmental resources.
Each resource is specified with four characteristics: Description of resources, a statement of
availability, time when the resources will be required and the duration of time the resource will
be applied.

Human resources-the planner begins the evaluating the scope and selecting the
skills required for complete development. For relatively small projects, a single individual may
perform all software engineering tasks by consulting with the specialist as required. The number
of people required for the software can be determined only after an estimate of development
effort is made.

Reusable software resources-to be reused effectively, software component should


be categorized for easy reference, standardized and validated for easy integration

Environmental resources-the environment support the software project, often


called software engineering component, and incorporates hardware and software. The hardware
provides a platform that supports the software required to produce the work products that are the
outcome of good software engineering practice.

DEPARTMENT OF COMPUTER SCIENCE Page 9


GOVERNMENT COLLEGE, KARIAVATTOM 10 PERIODIC TABLE

3. SYSTEM REQUIREMENTS

3.1 HARDWARE ENVIRONMENT

Processor : INTEL I3 or above

RAM : 4 GB

Hard Disk : 500 GB

Key Board : 104 Keys

Monitor : 20” LED/LCD

3.2 SOFTWARE ENVIRONMENT

Operating System : WINDOWS XP or WINDOWS 7

Language : CPP

DEPARTMENT OF COMPUTER SCIENCE Page 10


GOVERNMENT COLLEGE, KARIAVATTOM 11 PERIODIC TABLE

4. SYSTEM ANALYSIS

4.1. FEASIBILITY STUDY


The initial investigation points to be question whether the project is feasible. A
feasibility study is conducted to identify the best system that meets all the requirements. This
entails an identification description, an evaluation of proposed systems and selection of the best
system for the job. The requirement of the system is specified with a set of constraints such as
system objectives and description of the outputs. Then evaluate the feasibility of the proposed
system to generate above results.

Depending on the result of the initial investigation the study expanded to more
detail feasibility study. Feasibility study is a test o a system proposal accessing to its work
ability, impact on the organizations, ability to meet the user’s needs, and effective use of
resources. The objective is not to solve the problem but to accurate a sense of its scope. During
the study, the problem definition is crystallized and aspects of the problem to be included in the
system are determined. Consequently, cost and benefits are estimated with greater accuracy at
the stage.

The result of a feasibility study is a formal proposal. The proposal summarizes


what is known and what is going to be done.

It consists of following:

 Statement of the problem


 Summary of the finding and recommendations
 Details of findings
 Recommendations and conclusion

The feasibility study determines whether the proposed system is flexible or not.
One personal computer, a printer is necessary for the proposed system. The present project will

DEPARTMENT OF COMPUTER SCIENCE Page 11


GOVERNMENT COLLEGE, KARIAVATTOM 12 PERIODIC TABLE

improve quality of the image and reduced cost. There are incurred from implementing this
project as well as benefits.

The key considerations that are involved in feasibility analysis conducted are;

o Operational feasibility
o Economical feasibility
o Technical feasibility
o Behavioral feasibility

4.1.1. OPERATIONAL FEASIBILITY

An estimate should be made to determine how much effort and care will go into
the developing of the system including the training to be given to the user. Usually people
resisted new changes that are coming in their progression. It is common knowledge that the
computer installations would certainly affect the turn over, transfer and employee job status.
Hence an additional effort is to be made to train and educate the users on the new way of the
system.

4.1.2ECONOMICAL FEASIBILITY

Economical analysis is the most frequently used method for evaluating the
effectiveness of the candidate system. More commonly known as cost benefits analysis, the
procedure is to determine the benefits and savings that are expected from a candidate system and
compare with cost. It benefits over weigh costs then the decision is made to designed implement
the system. Otherwise further modifications or alteration in the proposed system will have to be
made if it is to have chance for being approves in accuracy in each face of system development

4.1.3TECHNICAL FEASIBILITY

Technical feasibility enters on the existing computer system and to what extend it
can support to the proposed addition .The system, been improved for single organization there
may be some addition that are to be made on the system by the user. The user some needs a
printed or some other hardware added to the system that will raise the technical complexity.
Then the user has to check whether the system will support the addition or not this involves
financial consideration to accommodate technical enhancement

DEPARTMENT OF COMPUTER SCIENCE Page 12


GOVERNMENT COLLEGE, KARIAVATTOM 13 PERIODIC TABLE

4.1.4BEHAVIORAL FEASIBILITY

Behavioral feasibility determines how much effort will go into educating, selling
and training the user staff on candidate system. People are inherently resistant to change and
computing has been known to facilitate change. Since the change is user friendly, user training is
a very easy matter.

The key steps to be considered during the feasibility study are:

 Prepare system flow chart


 Enumerate potential candidate system
 Describe and identify characteristics of candidate system.
 Determine and evaluate performance and cost effectiveness of each candidate system.
 Weight system performance and cost data
 Select the best candidate system

4.1.5LANGUAGE DESCRIPTION

a) ABOUT C++

Object oriented programming (OOPs) treats data as a critical element in program development
and does not allow it to flow freely around the system. It ties data more closely to the function
that operate on it, and protect it form modification from outside functions. OOPs allows
decomposition of a problem into a number of entities called objects and then builds data and
functions around those objects. some of the features of OOPs are 1) Emphasis is on data rather
than procedure. 2) Programs are divided into what are known as objects. 3) Data structures are
designed such that they characterize the objects. 4) Functions that operate on the data of an
object are tied together in the data structure. 5) Data is hidden and cannot be accessed by external
functions. 6) Objects may communicate with each other through functions. 7) New data and
functions can be easily adds wherever necessary.

DEPARTMENT OF COMPUTER SCIENCE Page 13


GOVERNMENT COLLEGE, KARIAVATTOM 14 PERIODIC TABLE

5. SYSTEM DESIGN

5.1 INPUT DESIGN

Input design is the process of converting user-oriented input to a computer based format. Input

design is a part of overall system design, which requires very careful attention .Often the
collection

of input data is the most expensive part of the system. The main objectives of the input design
are …

1. Produce cost effective method of input

2. Achieve highest possible level of accuracy

3. Ensure that the input is acceptable to and understood by the staff.

Input Data

The goal of designing input data is to make enter easy, logical and free from errors as possible.

The entering data entry operators need to know the allocated space for each field; field sequence

and which must match with that in the source document. The format in which the data fields are

entered should be given in the input form .Here data entry is online; it makes use of processor
that

Accepts commands and data from the operator through a keyboard. The input required is
analyzed

by the processor. It is then accepted or rejected. Input stages include the following processes.

1. Data Recording

2. Data Transcription

3. Data Conversion

DEPARTMENT OF COMPUTER SCIENCE Page 14


GOVERNMENT COLLEGE, KARIAVATTOM 15 PERIODIC TABLE

4. Data Verification

5. Data Control

6.Data Transmission

7.Data Correction

One of the aims of the system analyst must be to select data capture method and devices, which
reduce

the number of stages so as to reduce both the changes of errors and the cost .Input types, can be

characterized as.

• External

• Internal

• Operational

• Computerized

• Interactive

Input files can exist in document form before being input to the computer. Input design is rather

complex since it involves procedures for capturing data as well as inputting it to the computer.

5.2 OUTPUT DESIGN

Outputs from computer systems are required primarily to communicate the results of processing

to users. They are also used to provide a permanent copy of these result for latter consultation .

Computer output is the most important and direct source of information to the users. Designing

computer output should proceed in an organized well through out the manner. The right output

must be available for the people who find the system easy o use. The outputs have been defined

during the logical design stage. If not, they should defined at the beginning of the output
designing

terms of types of output connect, format, response etc,

Various types of outputs are

• External outputs

DEPARTMENT OF COMPUTER SCIENCE Page 15


GOVERNMENT COLLEGE, KARIAVATTOM 16 PERIODIC TABLE

• Internal outputs

• Operational outputs

• Interactive outputs

• Turn around outputs

All screens are informative and interactive in such a way that the user can full fill his

requirements through asking queries.

5.3 DATABASE DESIGN

The general theme behind a database is to handle information as an integrated whole.A database

is a collection of interrelated data stored with minimum redundancy to serve many users quickly

and effectively. After designing input and output, the analyst must concentrate on database
design

or how data should be organized around user requirements. The general objective is to make

information access, easy quick, inexpensive and flexible for other users. During database design
the

following objectives are concerned:-

1. Controlled Redundancy

2.Data independence

3.Accurate and integrating

4. More information at low cost

5. Recovery from failure

6. Privacy and security

7. Performance

8. Ease of learning and use

DEPARTMENT OF COMPUTER SCIENCE Page 16


GOVERNMENT COLLEGE, KARIAVATTOM 17 PERIODIC TABLE

6. IMPLEMENTATION AND TESTING


6.1 TYPE OF TESTING

There are many approaches to software testing, but effective testing of


complex products is essentially a process of investigation, not merely a matter of creating
and following rote posting phase involves the testing of developed system using various
kinds of data. Software testing is the process used to help identify the correctness,
completeness, security and quality of developed computer software. Testing is vital to the
success of the system Testing makes logical assumption that if all the parts of the system are
correct, the goal will be successfully achieved.

System Testing is a critical element of software quality assurance and


represents the ultimate review of specification, design and coding. The user tests the
developed system and changes are made according to their needs. The procedure. One
definition of testing is “the process of questioning, a product in order to evaluate it”, where
the “questions” are things the tester tries to do with the product, and the product answers
with its behavior in reaction to the probing of the tester. The quality of the application can,
and normally does, vary widely from system but some of the common quality attributes
include reliability, stability, portability, maintainability and usability.

Testing Objectives

 Testing is the process of executing the program with the intension of finding an
error
 A good test is one that has a high probability of finding an as-yet-undiscovered
error.
 A successful test is that which uncovers as-yet-undiscovered error.

Errors
System Configuration
Test Result Errors

Testing Evaluating Debug

Test configuration connection Expected Results


DEPARTMENT OF COMPUTER SCIENCE Page 17
GOVERNMENT COLLEGE, KARIAVATTOM 18 PERIODIC TABLE

Test Result

Fig: Test Information Flow

6.2 TEST PROCEDURE

The Procedure are,

 Prepare the test case


 Record the expected results are not tune with expected results, do not necessary work.
 Test again and check the result.

If the test results are satisfactory, wind up testing.

6.3 ITEM PASS/FAIL CRITERIA

The test case consists of different inputs with the expected results in each
case. During testing, the tester records the actual test result against the expected ones and if
it is found matching, the case is assigned as a pass. Otherwise, the test case is assigned as a
fail and orders for reword and reset.

6.4 STOP CRITERIA

Testing can be wrapped when:

 Actual test result matches with the expected ones.


 System performs well in the specified environment.

6.5WHITE BOX TESTING

White box testing strategy deals with a internal logic and structure of the
code. White box testing is also called as glass, structural, open box or clears box testing. The
test written based on the white box testing strategy incorporates coverage of the code
written, branches, paths, statements and internal logic of the code etc.

The system have been tested by providing variety of inputs to ensure that all
the statements are executed at least once and that too expected manner. All topic and

DEPARTMENT OF COMPUTER SCIENCE Page 18


GOVERNMENT COLLEGE, KARIAVATTOM 19 PERIODIC TABLE

transaction path from origin to destination was tested to identify and correct the possible
error.

6.6 BLACK BOX TESTING

Also known as functional testing. A software testing technique where, by the


internal workings of the item being tested are not known by the tester. In a black box test on
software design the tester only knows the inputs and what the expected outcomes should be
and not how the program arrives at those outputs. Black box testing is testing that occurs
from the viewpoint of an end user. Black box tests find bugs such as incorrect functions,
interface problems, and database errors. Black box technique focuses on information
domain of the software deriving test cases by partitioning input and output in a manner that
provides through coverage.

The test cases are developed for each condition or combination if condition
and submitted for processing. By examining the results, the performance of the program
according to its specified requirement can be determined.

6.7 UNIT TESTING

This is the first level of testing. In this different modules are tested against
the specifications produced during the design of the modules. Unit testing done for the
verification of the code produced during the coding phase and to test the internal logic of
modules. It refers the verification of the single program module in an isolated environment.
Unit testing first focused on the modules independently of one another to locate errors. After
coding each dialogue is tested and run individually. All unnecessary coding where removed
and it was ensured that all the modules work as the programmer would expect. Logical
errors found were corrected. So by working all the modules independently and verifying the
outputs of each module in the presence of the staff, we concluded that the program was
functioning as expected.

The project comprises of two major modules.

DEPARTMENT OF COMPUTER SCIENCE Page 19


GOVERNMENT COLLEGE, KARIAVATTOM 20 PERIODIC TABLE

 Admin
 Client

6.8 FUNCTIONALITY TESTING

A black box testing geared to function requirements of the system. In the


functionality each module is tested. Test focused on verifying target-of-test functions as
intended, providing the required services, methods and use cases.

6.9INTEGRATION TESTING

Data can be lost across an interface, one module can be have adverse afford
on another, sub functions, went combined, may not produce the desired major functions.
Integration testing is a systematic testing for constructing the program structure while at the
same time conducting tests to uncover errors associated with in the interface. The objective
is to take unit testing as a whole. Here correction is difficult because the vast expense of the
entire program complicate the isolation of courses. In integration testing steps, all errors
uncovered are corrected for the next step.

Various features need to be tested.

 Detect data exchange formats


 Module invocation sequences
 Navigability

6.10 VALIDATION TESTING

This provides the final assurance that software meets all the functional,
behavioral and performance requirements. The software is completely assembled on a
package. Validation succeeds when the software functions in a manner in which the user
expects. Validation refers to the process of using software in a live environment in order to
find errors. During the course of validating the system, failures may occur and sometimes
the coding has to be changed according to the requirements. Thus the feedback from the
validation phase generally precedes changes in the software. Once the application was made
DEPARTMENT OF COMPUTER SCIENCE Page 20
GOVERNMENT COLLEGE, KARIAVATTOM 21 PERIODIC TABLE

free of all logical and interface errors, inputting dummy data ensured that the software
developed satisfies all the requirements of the user. This dummy data is usually known as
the test case.

6.11 SYSTEM TESTING

The implemented system is tested of its functionality and whether it meets


the desired aims of the project. The test bed consists of Windows PCs, network over a
Logical area Network (LAN), as well as connected the internet and telephone. The server is
installed in one of the system, along with the required database. The client is then installed
on several systems the network, telephone and the Internet connections of the system are
verified. The server and the database are initialized. The clients are connected to the server
using the server’s IP address. The clients are connected to the server using the server’s IP
address. The connections are verified and all the functions are checked to verify that they
are working properly. Connections are made over LAN; internet and telephone. The system
testing phase successfully verifies the functionality of the software.

6.12 OUTPUT TESTING

After performing the validation testing the next step is the output testing of
the proposed system since no system should be useful if it does not provide the required
output in the specific. Asking the users about format required by them tests the output
generated or displayed by the system under consideration. Here, the output format is
considered in two ways, one on screen and another is in printed format. The output format
on the screen is formed to be correct as the format was designed in the system phase
according to users’ needs. For the hard copy also, the output comes out as the specified
requirements by the user in any correction in the system.

6.13 USER ACCEPTANCE TESTING

DEPARTMENT OF COMPUTER SCIENCE Page 21


GOVERNMENT COLLEGE, KARIAVATTOM 22 PERIODIC TABLE

User Acceptance of a system is the key factor for the success of any system.
The system under consideration is tested for user acceptance by constantly keeping in touch
with the prospective system. Users can make changes whenever required. This is done
regarding to the following points

 Input screen design


 Output screen design
 On-line message to guide the user
 Format of ad-hoc reports and other output

The above testing is done taking the various kinds of test data. Preparation
of test data places a vital role in the system test. After preparing the test data, the system
under study is tested using that test data. While testing the system by which test data errors
are again uncovered and corrected by using above testing steps and corrections are also
noted for future use.

6.14 TEST RESULTS

The knowledge about the test result is necessary to make further modifications. The
following are the test results,

 Program testing reveled that program is free from syntax and logical errors. The
output was found corrected.
 System testing revealed that all the modules of the system works properly under
peak loads and the system is capable of handling as many records.
 Acceptance testing contributes to the consistency and smooth working of the
system.

DEPARTMENT OF COMPUTER SCIENCE Page 22


GOVERNMENT COLLEGE, KARIAVATTOM 23 PERIODIC TABLE

7. CODE

//**********************************************************

// PROJECT MOBILE SHOP MANAGEMENT

//**********************************************************

//**********************************************************

// INCLUDED HEADER FILES

//**********************************************************

#include <iostream.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 NAME : Menu

DEPARTMENT OF COMPUTER SCIENCE Page 23


GOVERNMENT COLLEGE, KARIAVATTOM 24 PERIODIC TABLE

// DETAILS : IT CONTROLLS OVER ALL THE FUNCTIONS

//**********************************************************

class menu

public :

void main_menu(void) ;

private :

void edit_menu(void) ;

};

//**********************************************************

// CLASS NAME : Product

// DETAILS : IT CONTROLLS OVER ALL THE FUNCTIONS

// RELATED TO PRODUCT ITEMS

//**********************************************************

class product

public :

void add_item(void) ;

void delete_item(void) ;

void modify_item(void) ;

void list_of_item(void) ;

DEPARTMENT OF COMPUTER SCIENCE Page 24


GOVERNMENT COLLEGE, KARIAVATTOM 25 PERIODIC TABLE

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 NAME : Account

// DETAILS : IT CONTROLLS OVER ALL THE FUNCTIONS

// RELATED TO MAKING BILL

//**********************************************************

class account

public :

DEPARTMENT OF COMPUTER SCIENCE Page 25


GOVERNMENT COLLEGE, KARIAVATTOM 26 PERIODIC TABLE

void bill_list(void) ;

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 CREATE MAIN MENU AND CALLS OTHER FUNCTIONS

//**********************************************************

void menu :: main_menu(void)

clrscr() ;

char ch ;

while (1)

clrscr() ;

gotoxy(10,3) ;

DEPARTMENT OF COMPUTER SCIENCE Page 26


GOVERNMENT COLLEGE, KARIAVATTOM 27 PERIODIC TABLE

cout

<<"*************************************************************" ;

gotoxy(10,23) ;

cout

<<"*************************************************************" ;

gotoxy(28,6) ;

cout <<"MOBILE SHOP MANAGEMENT" ;

gotoxy(28,7) ;

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

gotoxy(30,9) ;

cout <<"1: PURCHASE MOBILE" ;

gotoxy(30,11) ;

cout <<"2: LIST OF MOBILES" ;

gotoxy(30,13) ;

cout <<"3: EDIT PRODUCTS FILE" ;

gotoxy(30,15) ;

cout <<"4: BILLS REPORT" ;

gotoxy(30,17) ;

cout <<"0: QUIT" ;

gotoxy(30,20) ;

cout <<"Enter Your Choice : " ;

ch = getche() ;

if (ch == '1')

product p ;

DEPARTMENT OF COMPUTER SCIENCE Page 27


GOVERNMENT COLLEGE, KARIAVATTOM 28 PERIODIC TABLE

p.purchase() ;

else if (ch == '2')

product p ;

p.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(void)

DEPARTMENT OF COMPUTER SCIENCE Page 28


GOVERNMENT COLLEGE, KARIAVATTOM 29 PERIODIC TABLE

char ch ;

while (1)

clrscr() ;

gotoxy(10,3) ;

cout

<<"*************************************************************" ;

gotoxy(10,23) ;

cout

<<"*************************************************************" ;

gotoxy(32,6) ;

cout <<"E D I T M E N U" ;

gotoxy(32,7) ;

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

gotoxy(32,10) ;

cout <<"1: ADD PRODUCTS" ;

gotoxy(32,12) ;

cout <<"2: MODIFY PRODUCTS" ;

gotoxy(32,14) ;

cout <<"3: DELETE PRODUCTS" ;

gotoxy(32,16) ;

cout <<"0: EXIT" ;

gotoxy(32,19) ;

cout <<"Enter Choice : " ;

DEPARTMENT OF COMPUTER SCIENCE Page 29


GOVERNMENT COLLEGE, KARIAVATTOM 30 PERIODIC TABLE

ch = getche() ;

if (ch == '1')

product p ;

p.add_item() ;

break ;

else if (ch == '2')

product p ;

p.modify_item() ;

break ;

else if (ch == '3')

product p ;

p.delete_item() ;

break ;

else if (ch == '0')

break ;

DEPARTMENT OF COMPUTER SCIENCE Page 30


GOVERNMENT COLLEGE, KARIAVATTOM 31 PERIODIC TABLE

//**********************************************************

// THIS FUNCTION RETURNS THE CODE OF THE LAST RECORD IN THE

// PRODUCT FILE (PRODUCT.DAT).

//**********************************************************

int product :: last_code(void)

fstream file ;

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

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

int t=0 ;

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

t = itemcode ;

file.close() ;

return t ;

//**********************************************************

// THIS FUNCTION DISPLAY THE LIST OF THE ITEMS

//**********************************************************

void product :: list_of_item(void)

clrscr() ;

DEPARTMENT OF COMPUTER SCIENCE Page 31


GOVERNMENT COLLEGE, KARIAVATTOM 32 PERIODIC TABLE

fstream file ;

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

file.seekg(0) ;

int row = 6 , found = 0 ;

gotoxy(30,2) ;

cout <<"LIST OF ITEMS" ;

gotoxy(3,4) ;

cout <<"ITEM CODE MOBILE NAME MOBILE CODE ITEM PRICE" ;

gotoxy(2,5) ;

cout <<"***********************************************************" ;

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

delay(20) ;

found = 1 ;

gotoxy(5,row) ;

cout <<itemcode ;

gotoxy(14,row) ;

cout <<itemname ;

gotoxy(37,row) ;

cout <<itemcost ;

gotoxy(51,row) ;

cout <<itemprice ;

if ( row == 22 )

row = 5 ;

DEPARTMENT OF COMPUTER SCIENCE Page 32


GOVERNMENT COLLEGE, KARIAVATTOM 33 PERIODIC TABLE

gotoxy(1,25) ;

cout <<"Press any key to continue..." ;

getche() ;

clrscr() ;

gotoxy(30,2) ;

cout <<"LIST OF ITEMS" ;

gotoxy(3,4) ;

cout <<"ITEM CODE MOBILE NAME MOBILE CODE ITEM PRICE" ;

gotoxy(2,5) ;

cout <<"***********************************************************"

else

row++ ;

if ( !found )

gotoxy(5,10) ;

cout <<"\7Records not found" ;

gotoxy(1,25) ;

cout <<"Press any key to continue..." ;

getche() ;

file.close () ;

DEPARTMENT OF COMPUTER SCIENCE Page 33


GOVERNMENT COLLEGE, KARIAVATTOM 34 PERIODIC TABLE

//***********************************************************

// THIS FUNCTION ADD RECORDS IN THE PRODUCT.DAT (PRODUCT.DAT)

//***********************************************************

void product :: 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 <<"ADDITION OF PRODUCTS" ;

gotoxy(26,4) ;

cout <<"********************" ;

gotoxy(5,6) ;

cout <<"Item Code : " <<tcode ;

gotoxy(5,8) ;

cout <<"Mobile Name : " ;

DEPARTMENT OF COMPUTER SCIENCE Page 34


GOVERNMENT COLLEGE, KARIAVATTOM 35 PERIODIC TABLE

gotoxy(5,10) ;

cout <<"Mobile Code : " ;

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 <<"Mobile Name : " ;

gets(itemname) ;

strupr(itemname) ;

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

return ;

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

valid = 0 ;

gotoxy(3,24) ;

DEPARTMENT OF COMPUTER SCIENCE Page 35


GOVERNMENT COLLEGE, KARIAVATTOM 36 PERIODIC TABLE

cout <<"\7 Range = 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 <<"Mobile code : " ;

gets(t_itemcost) ;

itemcost = atof(t_itemcost) ;

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

return ;

if (itemcost < 1 || itemcost > 800)

valid = 0 ;

DEPARTMENT OF COMPUTER SCIENCE Page 36


GOVERNMENT COLLEGE, KARIAVATTOM 37 PERIODIC TABLE

gotoxy(3,24) ;

cout <<"\7 Range = 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)

DEPARTMENT OF COMPUTER SCIENCE Page 37


GOVERNMENT COLLEGE, KARIAVATTOM 38 PERIODIC TABLE

valid = 0 ;

gotoxy(3,24) ;

cout <<"\7 Range = " <<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')

DEPARTMENT OF COMPUTER SCIENCE Page 38


GOVERNMENT COLLEGE, KARIAVATTOM 39 PERIODIC TABLE

itemcode = tcode ;

fstream file ;

file.open("PRODUCT.DAT", ios::out | ios::app ) ;

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

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') ;

DEPARTMENT OF COMPUTER SCIENCE Page 39


GOVERNMENT COLLEGE, KARIAVATTOM 40 PERIODIC TABLE

//**********************************************************

// THIS FUNCTION DISPLAY THE RECORD OF THE GIVEN CODE FROM

// THE PRODUCT FILE (PRODUCT.DAT)

//**********************************************************

void product :: display_record(int tcode)

fstream file ;

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

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

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

if (itemcode == tcode)

gotoxy(5,3) ;

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

gotoxy(5,4) ;

cout <<"Mobile Name : "<<itemname ;

gotoxy(5,5) ;

cout <<"Mobile Code : "<<itemcost ;

gotoxy(5,6) ;

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

DEPARTMENT OF COMPUTER SCIENCE Page 40


GOVERNMENT COLLEGE, KARIAVATTOM 41 PERIODIC TABLE

break ;

file.close() ;

//**********************************************************

// THIS FUNCTION RETURN THE VALUE 1 IF THE RECORD IS FOUND

// FOR THE GIVEN CODE IN THE PRODUCT FILE (PRODUCT.DAT)

//**********************************************************

int product :: item_found(int tcode)

fstream file ;

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

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

int found=0 ;

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

if (itemcode == tcode)

found++ ;

break ;

DEPARTMENT OF COMPUTER SCIENCE Page 41


GOVERNMENT COLLEGE, KARIAVATTOM 42 PERIODIC TABLE

file.close() ;

return found ;

//**********************************************************

// THIS FUNCTION RETURN THE RECORD NO. OF THE GIVEN CODE IN

// THE PRODUCT FILE (PRODUCT.DAT)

//**********************************************************

int product :: recordno(int tcode)

fstream file ;

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

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

int found=0 ;

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

found++ ;

if (itemcode == tcode)

break ;

file.close() ;

return found ;

DEPARTMENT OF COMPUTER SCIENCE Page 42


GOVERNMENT COLLEGE, KARIAVATTOM 43 PERIODIC TABLE

//**********************************************************

// THIS FUNCTION DELETES THE RECORD FOR THE GIVEN CODE FROM

// THE PRODUCT FILE (PRODUCT.DAT)

//**********************************************************

void product :: delete_record(int tcode)

fstream file ;

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

fstream temp ;

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

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

while ( !file.eof() )

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

if ( file.eof() )

break ;

if ( itemcode != tcode )

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

file.close() ;

temp.close() ;

DEPARTMENT OF COMPUTER SCIENCE Page 43


GOVERNMENT COLLEGE, KARIAVATTOM 44 PERIODIC TABLE

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

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

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

while ( !temp.eof() )

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

if ( temp.eof() )

break ;

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

file.close() ;

temp.close() ;

//**********************************************************

// THIS FUNCTION GIVES THE CODE NO. TO DELETE RECORD FROM

// THE PRODUCT FILE (PRODUCT.DAT)

//**********************************************************

void product :: delete_item(void)

clrscr() ;

char t_code[5], ch ;

int t, tcode ;

DEPARTMENT OF COMPUTER SCIENCE Page 44


GOVERNMENT COLLEGE, KARIAVATTOM 45 PERIODIC TABLE

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() ;

DEPARTMENT OF COMPUTER SCIENCE Page 45


GOVERNMENT COLLEGE, KARIAVATTOM 46 PERIODIC TABLE

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) : " ;

ch = getche() ;

ch = toupper(ch) ;

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

if (ch == 'N')

return ;

delete_record(tcode) ;

gotoxy(5,15) ;

cout <<"\7Record Deleted" ;

getch() ;

DEPARTMENT OF COMPUTER SCIENCE Page 46


GOVERNMENT COLLEGE, KARIAVATTOM 47 PERIODIC TABLE

//**********************************************************

// THIS FUNCTION MODIFY THE RECORD FOR THE GIVEN CODE FROM

// THE PRODUCT FILE (PRODUCT.DAT)

//**********************************************************

void product :: modify_record(int tcode)

int recno ;

recno = recordno(tcode) ;

int valid, t_code ;

char ch, t_itemcost[10], t_itemprice[10], t_itemcode[5] ;

gotoxy(71,2) ;

cout <<"<0>=Exit" ;

gotoxy(5,12) ;

cout <<"Item Code : " ;

gotoxy(5,14) ;

cout <<"Mobile Name : " ;

gotoxy(5,16) ;

cout <<"Mobile Code : " ;

gotoxy(5,18) ;

cout <<"Item Price : " ;

do

DEPARTMENT OF COMPUTER SCIENCE Page 47


GOVERNMENT COLLEGE, KARIAVATTOM 48 PERIODIC TABLE

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)

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) ;

DEPARTMENT OF COMPUTER SCIENCE Page 48


GOVERNMENT COLLEGE, KARIAVATTOM 49 PERIODIC TABLE

if (t_code == 0)

return ;

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

valid = 0 ;

gotoxy(3,24) ;

cout <<"\7 CODE 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 ;

DEPARTMENT OF COMPUTER SCIENCE Page 49


GOVERNMENT COLLEGE, KARIAVATTOM 50 PERIODIC TABLE

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 <<"Mobile Name : " ;

gets(itemname) ;

strupr(itemname) ;

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

return ;

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

valid = 0 ;

gotoxy(3,24) ;

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

getch() ;

do

gotoxy(20,16) ;

DEPARTMENT OF COMPUTER SCIENCE Page 50


GOVERNMENT COLLEGE, KARIAVATTOM 51 PERIODIC TABLE

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,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 <<"Mobile Code " ;

gets(t_itemcost) ;

itemcost = atof(t_itemcost) ;

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

DEPARTMENT OF COMPUTER SCIENCE Page 51


GOVERNMENT COLLEGE, KARIAVATTOM 52 PERIODIC TABLE

return ;

if (itemcost < 1 || itemcost > 800)

valid = 0 ;

gotoxy(3,24) ;

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

getch() ;

do

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) ;

DEPARTMENT OF COMPUTER SCIENCE Page 52


GOVERNMENT COLLEGE, KARIAVATTOM 53 PERIODIC TABLE

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 <<"\7 Range = " <<itemcost <<"..1000" ;

getch() ;

do

gotoxy(1,21) ;

clreol() ;

DEPARTMENT OF COMPUTER SCIENCE Page 53


GOVERNMENT COLLEGE, KARIAVATTOM 54 PERIODIC TABLE

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') ;

if (ch == 'N')

return ;

itemcode = t_code ;

cout <<"\n" <<itemname ;

cout <<itemcost ;

cout <<itemprice ;

getch() ;

fstream file ;

file.open("PRODUCT.DAT", ios::out | ios::ate) ;

int location ;

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

file.seekp(location) ;

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

DEPARTMENT OF COMPUTER SCIENCE Page 54


GOVERNMENT COLLEGE, KARIAVATTOM 55 PERIODIC TABLE

file.close() ;

sort() ;

clrscr() ;

gotoxy(5,15) ;

cout <<"\7Record Modified" ;

getch() ;

//**********************************************************

// THIS FUNCTION GIVES THE CODE NO. TO MODIFY RECORD FROM

// THE PRODUCT FILE (PRODUCT.DAT)

//**********************************************************

void product :: modify_item(void)

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) ;

DEPARTMENT OF COMPUTER SCIENCE Page 55


GOVERNMENT COLLEGE, KARIAVATTOM 56 PERIODIC TABLE

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 modify : " ;

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 ;

DEPARTMENT OF COMPUTER SCIENCE Page 56


GOVERNMENT COLLEGE, KARIAVATTOM 57 PERIODIC TABLE

display_record(tcode) ;

do

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 PRODUCT FILE (PRODUCT.DAT)

// ACCORDING TO THE CODE NOS.

//****************************************************************

void product :: sort(void)

int i=0,j ;

product arr[100] ;

DEPARTMENT OF COMPUTER SCIENCE Page 57


GOVERNMENT COLLEGE, KARIAVATTOM 58 PERIODIC TABLE

product temp ;

fstream file ;

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

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

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

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("PRODUCT.DAT", ios::out) ;

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

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

file.close() ;

DEPARTMENT OF COMPUTER SCIENCE Page 58


GOVERNMENT COLLEGE, KARIAVATTOM 59 PERIODIC TABLE

//**********************************************************

// THIS FUNCTION PURCHASES THE PRODUCT ITEM IN THE MENU

//**********************************************************

void product :: purchase(void)

clrscr() ;

account a ;

int t_billno, purchased=0 ;

t_billno = a.last_billno() ;

t_billno++ ;

char t_code[5], ch;

float t_quantity ;

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 ;

DEPARTMENT OF COMPUTER SCIENCE Page 59


GOVERNMENT COLLEGE, KARIAVATTOM 60 PERIODIC TABLE

do

clrscr() ;

gotoxy(3,25) ;

cout <<"Press <ENTER> to see the list" ;

gotoxy(5,3) ;

cout <<"Enter Item Code of the item to be Purchase : " ;

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(3,25) ;

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

gotoxy(5,24) ;

cout <<"Enter Item Code of the item to be Purchase : " ;

DEPARTMENT OF COMPUTER SCIENCE Page 60


GOVERNMENT COLLEGE, KARIAVATTOM 61 PERIODIC TABLE

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

DEPARTMENT OF COMPUTER SCIENCE Page 61


GOVERNMENT COLLEGE, KARIAVATTOM 62 PERIODIC TABLE

valid = 1 ;

gotoxy(1,8) ;

clreol() ;

gotoxy(1,24) ;

clreol() ;

gotoxy(1,25) ;

clreol() ;

gotoxy(3,25) ;

cout <<"ENTER QUANTITY TO BE PURCHASE IN Kg." ;

gotoxy(5,8) ;

cout <<"Quantity : " ;

cin>>t_quantity ;

qty=t_quantity ;

if (t_quantity == 0)

if (purchased)

a.prepare_bill(t_billno) ;

return ;

if (qty < 1 || qty > 800)

valid = 0 ;

gotoxy(3,24) ;

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

getch() ;

DEPARTMENT OF COMPUTER SCIENCE Page 62


GOVERNMENT COLLEGE, KARIAVATTOM 63 PERIODIC TABLE

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("PRODUCT.DAT", ios::in) ;

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

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

if (itemcode == tcode)

t_itemcode = itemcode ;

strcpy(t_itemname,itemname) ;

DEPARTMENT OF COMPUTER SCIENCE Page 63


GOVERNMENT COLLEGE, KARIAVATTOM 64 PERIODIC TABLE

t_cost = itemcost ;

t_price = itemprice ;

t_qty = qty ;

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) ;

DEPARTMENT OF COMPUTER SCIENCE Page 64


GOVERNMENT COLLEGE, KARIAVATTOM 65 PERIODIC TABLE

//**********************************************************

// THIS FUNCTION RETURNS THE BILL NO. OF THE LAST RECORD

// IN THE BILL FILE (BILL.DAT)

//**********************************************************

int account :: last_billno(void)

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)

//**********************************************************

void account :: add_bill(int t_billno, int t_itemcode, char

t_itemname[30], float t_qty, float t_cost, float t_price)

DEPARTMENT OF COMPUTER SCIENCE Page 65


GOVERNMENT COLLEGE, KARIAVATTOM 66 PERIODIC TABLE

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

DEPARTMENT OF COMPUTER SCIENCE Page 66


GOVERNMENT COLLEGE, KARIAVATTOM 67 PERIODIC TABLE

// 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 ;

float total=0.0, total_bill=0.0 ;

gotoxy(33,3) ;

cout <<"CUSTOMER BILL" ;

gotoxy(55,5) ;

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

gotoxy(8,7) ;

cout <<"ITEMS PURCHASED" ;

gotoxy(8,8) ;

cout <<"+++++++++++++++" ;

gotoxy(8,9) ;

cout <<"Item code Mobile name Mobile code Price Qty Total"

gotoxy(8,10) ;

DEPARTMENT OF COMPUTER SCIENCE Page 67


GOVERNMENT COLLEGE, KARIAVATTOM 68 PERIODIC TABLE

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

int row=11 ;

fstream file ;

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

file.seekg(0) ;

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

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 ;

DEPARTMENT OF COMPUTER SCIENCE Page 68


GOVERNMENT COLLEGE, KARIAVATTOM 69 PERIODIC TABLE

gotoxy(63,row) ;

cout <<total ;

total_bill = total_bill + total ;

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, flag=0 ;

float total=0.0, total_bill=0.0 ;

DEPARTMENT OF COMPUTER SCIENCE Page 69


GOVERNMENT COLLEGE, KARIAVATTOM 70 PERIODIC TABLE

gotoxy(30,2) ;

cout <<"LIST OF BILLS" ;

gotoxy(3,4) ;

cout <<"Billno. Date Item Code Mobile name Mobile code 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)

gotoxy(52,row) ;

cout <<"TOTAL BILL: Rs." <<total_bill <<"/=" ;

total_bill = 0.0 ;

row++ ;

gotoxy(4,row) ;

cout <<billno ;

DEPARTMENT OF COMPUTER SCIENCE Page 70


GOVERNMENT COLLEGE, KARIAVATTOM 71 PERIODIC TABLE

flag = 1 ;

gotoxy(11,row) ;

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

gotoxy(24,row) ;

cout <<code ;

gotoxy(32,row) ;

cout <<name ;

gotoxy(52,row) ;

cout <<cost ;

gotoxy(59,row) ;

cout <<price ;

gotoxy(67,row) ;

cout <<quantity ;

total = quantity * price ;

gotoxy(73,row) ;

cout <<total ;

total_bill = total_bill + total ;

if ( row >= 23 )

row = 5 ;

gotoxy(66,1) ;

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

pageno++ ;

gotoxy(1,25) ;

cout <<"Press any key to continue..." ;

DEPARTMENT OF COMPUTER SCIENCE Page 71


GOVERNMENT COLLEGE, KARIAVATTOM 72 PERIODIC TABLE

getche() ;

clrscr() ;

gotoxy(30,2) ;

cout <<"LIST OF BILLS" ;

gotoxy(3,4) ;

cout <<"Billno. Date Item Code Mobile name M.code Price Qty Total" ;

gotoxy(3,5) ;

cout

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

prev_billno = billno ;

row++ ;

gotoxy(52,row) ;

cout <<"TOTAL BILL: Rs." <<total_bill <<"/=" ;

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..." ;

DEPARTMENT OF COMPUTER SCIENCE Page 72


GOVERNMENT COLLEGE, KARIAVATTOM 73 PERIODIC TABLE

getche() ;

file.close () ;

//**********************************************************

// THIS FUNCTION IS THE MAIN FUNCTION CALLING THE MAIN MENU

//**********************************************************

void main(void)

clrscr() ;

menu m ;

m.main_menu() ;

8.OUTPUT

DEPARTMENT OF COMPUTER SCIENCE Page 73


GOVERNMENT COLLEGE, KARIAVATTOM 74 PERIODIC TABLE

DEPARTMENT OF COMPUTER SCIENCE Page 74


GOVERNMENT COLLEGE, KARIAVATTOM 75 PERIODIC TABLE

9. CONCLUSION

Our project is only a humble venture to satisfy the needs in a Periodic Table. Several user
friendly coding have also adopted. The project titled Periodic Table is an application software
for monitoring and helping for searching the details of each elements in modern periodic
Table.The project “Periodic Table” is developed in Object Oriented Programming Language like
C++ which mainly focuses on basic details of each elements in periodic Table.

The “Periodic Table” has the potential of servicing as a powerful tool in the
speedier and more precise functioning. This system can add much to the goodwill because it
reduces the time taken to render services drastically .The recourses needed to run the system is
less in cost and highly reliable. The implementation and operation of the system can be carried
out with minimal expense and expertise. The system can be judged beneficial to the registration,
as it requires no specifically trained professional to operate it. Most functions are automated and
user friendly.

The specific benefits of the system may be enumerated as follows...

 Fast, Accurate, efficient and Time saving.


 Higher data security and validity
 Ensures security.
 Minimum risk of data loss.

DEPARTMENT OF COMPUTER SCIENCE Page 75


GOVERNMENT COLLEGE, KARIAVATTOM 76 PERIODIC TABLE

10. BIBLIOGRAPHY

Web Sites:

1) http://www.learncpponline.com/

2) http://www.Cplusplus.com/

3)www.learncpp.com

4)www.tutorialspoint.com

Books:

1)Let Us C++ by Yashwanth Kanekar

2)The C++ Programming Language by Bjarne Stroustrup

3)Object Oriented Programming C++ by E Balaguruswami

DEPARTMENT OF COMPUTER SCIENCE Page 76

Vous aimerez peut-être aussi