0% found this document useful (0 votes)
85 views49 pages

Open Ended Activity Report On: Grocery Store Billing System

The document describes the design of a grocery store billing system implemented in C++. It includes classes to represent items, customers, and employees. Items are categorized into food, toiletries, and home essentials, with food further divided into subclasses. Customers are classified by membership level. Employees are categorized into store manager, cashier, and support staff roles. The design uses object-oriented principles like inheritance, aggregation, and singleton patterns. Key classes and their relationships are represented in a class diagram. Functions are defined to calculate taxes, total bills, and other operations.

Uploaded by

ben
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views49 pages

Open Ended Activity Report On: Grocery Store Billing System

The document describes the design of a grocery store billing system implemented in C++. It includes classes to represent items, customers, and employees. Items are categorized into food, toiletries, and home essentials, with food further divided into subclasses. Customers are classified by membership level. Employees are categorized into store manager, cashier, and support staff roles. The design uses object-oriented principles like inheritance, aggregation, and singleton patterns. Key classes and their relationships are represented in a class diagram. Functions are defined to calculate taxes, total bills, and other operations.

Uploaded by

ben
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 49

Armed Forces

KLE Society's
KLE Technological University

Open Ended Activity Report


On
Grocery Store Billing System
Object Oriented Programming with C++ (20ECSC204)
Object Oriented Programming with C++ Lab (20ECSP203)

Submitted by
Name Roll no SRN
Abdul Azeez 107 01FE19BCS009
Sairajath R. N 116 01FE19BCS020
Yashasvi A R 114 01FE19BCS017
Anu B Herakal 133 01FE19BCS038

Team Number: 01

Faculty In-charge:

Prof Somashekar Patil

SCHOOL OF COMPUTER SCIENCE & ENGINEERING


HUBLI – 580 031 (India).
Academic year 2019-20

School of Computer Science and Engineering 4A21 Page 1


Armed Forces

1. Introduction
1.1 Overview of the Problem Statement

1.2 Features of Application

1.2.1 Class Item

1.2.2 Class Customer

1.2.3 Class Employee

2. Design

2.1 Class Diagram


2.2 Description of Each Class

2.3 Main Function

2.4 Use of Standard Design Patterns

3. Unit Test Plan

3.1 Recruitment: void recruitment(Person p)

3.2 Firing and reloading a gun: void fireGun(Gun *g), void reload(Gun *g)

3.3 Flying a Fighter Jet: void fly(FighterJet *fj)

3.4 Training: void training(MilitaryPersonnel *mp)

4 Implementation

4.1 Results

1. Introduction

School of Computer Science and Engineering 4A21 Page 2


Armed Forces

i. Overview of Problem Statement

The Grocery store billing system consists of different divisions: Customers, items, employees. Class
item inherites from class food, class toiletries, class home essentials. Class food inherites from class
farm fresh, class preserved, class poultry. Class toiletries inherites from class imported and class
made_in_india. A class date has a “has” a relation with class food and class toiletries, class date
provides the attributes “dom(date of manufacture), doe(date of expiry)”. Class normal

ii. Features of Application


This project starts with the main class grocery store. The respective classes
listed below have a has-a-relation with the class grocery store.

1. Class Item

All the items present in the store are listed under this class. The products are classified in as
Food(GST 18%) , toileteries(GST 22%) and home essentials(GST 30%).
Food is classified into three categories. Farm fresh, preserved and poultry.
Farm fresh contains food items such as fruits and vegetables i.e anything which is to be
consumed fresh.(tax applied 0%)
Preserved food contains all foods that are packed and contain some form of preservatives
Such as chips, soft drinks, packed milk etc.(tax applied 8%)
Poultry contains food items like chicken meat and eggs. (tax applies 5%)
consumer products used in personal hygiene and for beautification are categorised under
Toiletries certain items under toiletries are either imported(tax applicable 26%) or made in
India(tax free).
Items that provide comfort and safety are classified under home essentials such as bed
sheets,blankets ,home hygiene etc.

School of Computer Science and Engineering 4A21 Page 3


Armed Forces

2. Class Customer
Customers are classified based on their membership status
Customer that have premium membership can avail 27% discount on their total bill
Customers that have VIP membership can avail 19% discount on their total bill
Non member customers don’t get any discount

3. Class Employee
The people employed at the grocery store are categorised as store manager,cashier
and support staff
The store manager is paid 15000 rupees monthly..
The cashier is paid 10000 rupees monthly.
The support staff are paid 5000 rupees monthly.
There might be several cashiers working in shifts

School of Computer Science and Engineering 4A21 Page 4


Armed Forces

2. Design

i. Class Diagram

School of Computer Science and Engineering 4A21 Page 5


Armed Forces

item

School of Computer Science and Engineering 4A21 Page 6


Armed Forces

ii. Description of Each Class


1. Grocery Store

 This is the main class which is used to display the store name
 It has 3 sub classes: Item,Employee, Customer.
 The classes like employee,customer and item aggregate from it.

School of Computer Science and Engineering 4A21 Page 7


Armed Forces

2. Item

 It is a class which has 2 objects which are used to display name and code of the item later.
 It further inherits form Class food, toiletries and home essentials

3. Customer

 This class has 4 objects which are used to display customer details
 This class is further in a has-a relation with Class Premium,Class VIP,Class normal.
 .

School of Computer Science and Engineering 4A21 Page 8


Armed Forces

4. Employee

 This class has objects name and salary which are further used in functions getemp( ) and dispay( )
 This class further in a has-a relation with Class store manager,Class cashier,Class support staff.

School of Computer Science and Engineering 4A21 Page 9


Armed Forces

5.Class Food.

 This is a class which has 4 objects which are further used in functions getfood( ) and
calgst( )
 The functions used in the class are made public
 This class further is in a has-a relation with Class date where class date provides DOM and DOE. This
class inherits from Class Farm Fresh,Class Preserved and Class Poultry.

6. Class Farm Fresh,Preserved and Poultry

School of Computer Science and Engineering 4A21 Page 10


Armed Forces

 The above classes are used to classify and create objects of food type using
666666666669999999999factory design pattern.66666666669999999999 \
 The food items classified under classes Farm Fresh,Preserved(singleton class) and
Poultry(singleton class) have extra taxes respectively . Each of the class has 2 functions to
calculate the tax and display the final price(Farm Frsh has only one function to display the price).

7. Toiletries

 The class toiletries has 5 objects and 2 functions getoil( ) and calgst( )
 The functions used in the class are made public
 This class inherits from Class Imported and Class Made_in_India.

8. Class imported , Made_in_India.

School of Computer Science and Engineering 4A21 Page 11


Armed Forces

 The class imported is a singleton class which has only one object and two functions
caltax( ) and displayprice( )

 The class made_in_India has no object and only one function i.e displayprice( )

9. Class Store Manager, Cashier,Support staff

 Each of this class is in a has-a-relation Class Employee


 Each of this class is a singleton class

10. Class Premium, VIP, Normal

 Each of this class is in a has-a-relation Class Customer


 Each of this class is a singleton class except Class Normal

School of Computer Science and Engineering 4A21 Page 12


Armed Forces

iii. Main Function


In the main function authentication is required to access the program. The authentication is
accomplished by using error exception

After the authentication the read and display functions are called to read an display the already
stored data from the text files.

In main function we create a single object of Army, AirForce and Navy.

There is a switch menu for different options like creating Person, Artillery, Vehicles and Bases.
Also options like recruiting MilitaryPersonnel and simulating a war are provided.

According to the user input we will create a Vehicle and an Artillery using factory design pattern.
Once they get created we ask user which military area they want to keep them in. After creating a
person user can enroll him for recruitment drive . Using Army, Navy and AirForce objects any of
the functions of ArmedForces can be called. Any exceptions are handled through the instantiation
of the object of ErrorException class.

iv. Use of Standard Design Patterns

Factory design pattern and singleton pattern are used for the above application.
• Factory method pattern(creational pattern):

• Definition:- The Factory Method pattern is a design pattern used to define


a runtime interface for creating an object. It’s called a factory because it creates
various types of objects without necessarily knowing what kind of object it
creates or how to create it.
• Usage:- Factory method is suitable for this scenario because vehicle
objects are to be created as per user demand, so to create the objects of the
required vehicle type during the run time interface it becomes easier. Similarly
artillery are to be created as per the requirements of the armed forces.

School of Computer Science and Engineering 4A21 Page 13


Armed Forces

• Singleton Pattern(creational pattern):

• Definition:- This type of design pattern comes under creational pattern as


this pattern provides one of the best ways to create an object.
This pattern involves a single class which is responsible to create an object
while making sure that only single object gets created. This class provides a
way to access its only object which can be accessed directly without need to
instantiate the object of the class.
• Usage:- Singleton pattern is suitable for this scenario because there can
be only one navy,army and airforce in the country.

3. Unit Test plan

1. Authentication
The user is required to enter the correct password to be able to use the system
THE SYSTEM WILL RESPOND AS FOLLOWS:-

i. When entered correect password

Ii. When entered wrong password

School of Computer Science and Engineering 4A21 Page 14


Armed Forces

2. The customer details are displayed by reading it directly from .txt file

Expected output:-

Customer name: JAY


Customer Phone Number: 9587412654
Total bill of customer with 27% discount………
PREMIUM CUSTOMER

ACTUAL OUTPUT:- JUNK VALUES

SIMILARLY THE OTHER READ FUNCTIONS ARE USED TO READ FROM THE
.TXT FILES AND THE DISPLAY FUNCTIONS ARE USED TO DISLPAY MANAGER
DETAILS, CASHIER DETAILS, SUPPORT STAFF DETAILS, CUSTOMERS DETAILS
WITH PREMIUM MEMBERSHIP, VIP AND NORMAL MEMBERSHIP. ITEM DETAILS
WHICH ARE FOOD,TOILETTRIES AND HOME ESSENTIALS.

School of Computer Science and Engineering 4A21 Page 15


Armed Forces

1. Recruitment: void recruitment(Person p)

The recruitment process involves giving person details, analyzing the details and
checking the eligibility criteria, giving the induction test and finally the induction of
that person in a particular force.

Given below is how a person gets inducted into a force:

First the details of the person are stored.

Then the person is asked for the force they want to join, and their eligibility is checked:

Test case 1: Passing the Eligibility criteria

Input:

Welcome to recruitment drive

1. Create a person to recruit


2. Use a created person

1
Enter person details
Full Name: Ankit
Age: 18
Blood group: B+ve
Height: 1.88

Select the force:

School of Computer Science and Engineering 4A21 Page 16


Armed Forces

1. Army
2. AirForce
3. Navy
2
Enter y for yes and n for no for the following:
1. Educational qualification: Passed Intermediate with Mathematics, Physics and
English with minimum 50% marks in aggregate and 50% marks in English.
y
2. Marital status:
n
3. Without glasses better eye 6/6 and worse eye 6/9 and not colour blind and not
suffering from night blindness:
y
4. Good mental and physical health free from any disease/disability. y
5. Permanent body tattoos other than on inner face of the fore arms n

Expected output:

Person "Ankit" created successfully.

You are eligible for screening test

Actual output:

Test case 2: Failing the Eligibility criteria

Input:

Welcome to recruitment drive

School of Computer Science and Engineering 4A21 Page 17


Armed Forces

1. Create a person to recruit


2. Use a created person

1
Enter person details
Full Name: Rohan
Age: 21
Blood group: B-ve
Height: 1.23

Select the force:


1. Army
2. AirForce
3. Navy
2
1. Educational qualification: Passed Intermediate with Mathematics, Physics and
English with minimum 50% marks in aggregate and 50% marks in English.
y
2. Marital status:
n
3. Without glasses better eye 6/6 and worse eye 6/9 and not colour blind and not
suffering from night blindness:
y
4. Good mental and physical health free from any disease/disability. y
5. Permanent body tattoos other than on inner face of the fore arms n

Expected output:

Person "Rohan" created successfully.

You are not eligible for screening test

Actual Output:

School of Computer Science and Engineering 4A21 Page 18


Armed Forces

Then the person gives the screening test and after passing the test, he gets inducted.
Service Number and Rank are assigned to that person:

Test case 3: Passing the induction test

Input:

Enter "ok" to take the test:


ok
Answer the following MCQ type questions by entering the options:
1. The High Courts at Calcutta, Madras and Bombay were established under the
a. Indian High Courts Act, 1911
b. Government of India Act, 1909
c. Indian High Courts Act, 1861
d. Indian High Courts Act, 1865

c
2. Capital of India was transferred from Calcutta to Delhi in the year: a.
1901
b. 1911
c. 1921
d. 1922

b
3. The world's longest river is:
a. Brahmaputra

School of Computer Science and Engineering 4A21 Page 19


Armed Forces

b. Amazon
c. Nile
d. Mississipi

c
4. Which of the following is not a union territory ?
a. Laddakh
b. Sikkim
c. Lakshadweep
d. Puducherry

b
5. Which one of the following does not remain to be a planet now ?
a. Neptune
b. Uranus
c. Pluto
d. Venus

c
Enter the details like service number,rank,enrollment date and service:
788546
Aircraftsmen
25/Apr/2020
AirForce

Expected Output:

Person "Ankit" inducted into AirForce successfully. The


person details are:
Ankit:18:1.88:B+ve
788546:Aircraftsmen:25/Apr/2020:AirForce

Actual Output:

School of Computer Science and Engineering 4A21 Page 20


Armed Forces

Test case 4: Failing the induction test:

Input:
School of Computer Science and Engineering 4A21 Page 21
Armed Forces

Enter "ok" to take the test:


ok
Answer the following MCQ type questions by entering the options:
1. The High Courts at Calcutta, Madras and Bombay were established under the
a. Indian High Courts Act, 1911
b. Government of India Act, 1909
c. Indian High Courts Act, 1861
d. Indian High Courts Act, 1865

a
2. Capital of India was transferred from Calcutta to Delhi in the year:
a. 1901
b. 1911
c. 1921
d. 1922

d
3. The world's longest river is:
a. Brahmaputra
b. Amazon
c. Nile
d. Mississipi

c
4. Which of the following is not a union territory ?
a. Laddakh
b. Sikkim
c. Lakshadweep
d. Puducherry

c
5. Which one of the following does not remain to be a planet now ?
a. Neptune
b. Uranus
c. Pluto
d. Venus
b

Expected Output:

You failed the test

School of Computer Science and Engineering 4A21 Page 22


Armed Forces

Actual Output:

2. Firing and reloading a gun: void fireGun(Gun *g), void reload(Gun *g)

A person is assigned a gun to participate in war activities. He can fire it in single mode
or burst mode. The gun can be reloaded once it has been fired.

Assigning of a gun to a person:

School of Computer Science and Engineering 4A21 Page 23


Armed Forces

Test case 5: Firing of gun in single and burst mode:

Input:

Select an option
1. Fire a gun
2. Throw a grenade
3. Fly an aircraft
4. Submerge a submarine
5. Deploy a tank
6. Deploy a Warship

1
Enter gun name
M416
Enter the fullname to search
Ankit
Select an option
1. Fire single
2. Fire in Burst mode(3 bullets)
3. Reload
4. Exit
1
Select an option
1. Fire single
2. Fire in Burst mode(3 bullets)
3. Reload
4. Exit

School of Computer Science and Engineering 4A21 Page 24


Armed Forces

Expected Output:

Ankit has fired the gun M416 and now the count of bullets in it is 39
Ankit has fired the gun M416 and now the count of bullets in it is 38
Ankit has fired the gun M416 and now the count of bullets in it is 37 Ankit
has fired the gun M416 and now the count of bullets in it is 36

Actual Output:

Test case 6: Reloading of the gun:

Input:

Select an option
1. Fire single
2. Fire in Burst mode(3 bullets)
3. Reload
4. Exit
3

Expected Output:
The Gun is reloaded. The number of bullets are:41

Actual Output:

School of Computer Science and Engineering 4A21 Page 25


Armed Forces

Test case 7: Gun not found:

Input:

Select the option


1. Prepare for War
2. Perform War Activities
2
Select an option
1. Fire a gun
2. Throw a grenade
3. Fly an aircraft
4. Submerge a submarine
5. Deploy a tank
6. Deploy a Warship

1
Enter gun name
AK51

Expected output:

8:Gun not found

Actual Output:

School of Computer Science and Engineering 4A21 Page 26


Armed Forces

Test case 8: Military Personnel not found:

Input:

Select the option


1. Prepare for War
2. Perform War Activities
2
Select an option
1. Fire a gun
2. Throw a grenade
3. Fly an aircraft
4. Submerge a submarine
5. Deploy a tank
6. Deploy a Warship

1
Enter gun name
M416
Enter the fullname to search
Ash

Expected Output:
10:Military personnel not found
Actual output:

School of Computer Science and Engineering 4A21 Page 27


Armed Forces

Test case 9: Bullets became zero

Input:

Select an option
1. Fire single
2. Fire in Burst mode(3 bullets)
3. Reload
4. Exit
1
Select an option
1. Fire single
2. Fire in Burst mode(3 bullets)
3. Reload
4. Exit
1

Expected Output:

Ankit has fired the gun M416 and now the count of bullets in it is 0

2: This gun has zero bullets

Actual Output:

School of Computer Science and Engineering 4A21 Page 28


Armed Forces

3. Flying a Fighter Jet: void fly(FighterJet *fj)

A person is assigned to a Fighter Jet. The flying of a fighter jet can be simulated using
this method:

Test case 10: Assigning Fighter Jet to person and flying:

Input:

Select an option
1. Fire a gun
2. Throw a grenade
3. Fly an aircraft
4. Submerge a submarine
5. Deploy a tank
6. Deploy a Warship 3
Enter Fighter Jet name
Tejas
Enter person name
Ankit
Ankit is flying the fighterjet Tejas

Expected Ouptut:

Ankit is flying the fighterjet Tejas


Actual Output:

School of Computer Science and Engineering 4A21 Page 29


Armed Forces

Test case 11: Fighter Jet not found:

Input:
Select an option
1. Fire a gun
2. Throw a grenade
3. Fly an aircraft
4. Submerge a submarine
5. Deploy a tank
6. Deploy a Warship

3
Enter Fighter Jet name
Mig-21

Expected Output:

11:Fighterjet not found

Actual Output:

School of Computer Science and Engineering 4A21 Page 30


Armed Forces

4. Training: void training(MilitaryPersonnel mp)

An already inducted MilitaryPersonnel undergoes training. The method can be used to


train one person at a time or all the persons at one go.

Test case 12: Training one person at a time:

Input:

Select the option


1. Train a particular person
2. Train all
3. Create vehicles
4. Create Artillery
5. Exit
1
Enter the fullname to search
Ankit

Expected Output:

Military personnel Ankit is undergoing training.


Actual Output:

School of Computer Science and Engineering 4A21 Page 31


Armed Forces

Test case 13: Person not found:

Input:

Select the option


1. Train a particular person
2. Train all
3. Create vehicles
4. Create Artillery
5. Exit
1
Enter the fullname to search
Ash

Expected Output:

10:Military personnel not found

Actual Output:

Test case 14: Training all persons at one go:

Input:

School of Computer Science and Engineering 4A21 Page 32


Armed Forces

Select the option


1. Train a particular person
2. Train all
3. Create vehicles
4. Create Artillery
5. Exit
2

Expected Output:

Military personnel Ash is undergoing training.


Military personnel Alok is undergoing training.

Actual Output:

4. Results

1. Main Menu

School of Computer Science and Engineering 4A21 Page 33


Armed Forces

Exception handling in main menu:

2. Create person

School of Computer Science and Engineering 4A21 Page 34


Armed Forces

3. Create a Base

4. Create submarine

School of Computer Science and Engineering 4A21 Page 35


Armed Forces

5. Create Warship

6. Create Tank

School of Computer Science and Engineering 4A21 Page 36


Armed Forces

7. Create FighterJet

8. Exception handling in Create Vehicles if a military area is not found

School of Computer Science and Engineering 4A21 Page 37


Armed Forces

9. Create gun

10. Create a grenade

School of Computer Science and Engineering 4A21 Page 38


Armed Forces

11. Exception handling in Create Artillery if a military area is not found

12. Recruitment

School of Computer Science and Engineering 4A21 Page 39


Armed Forces

School of Computer Science and Engineering 4A21 Page 40


Armed Forces

13. Training

Single person training:

School of Computer Science and Engineering 4A21 Page 41


Armed Forces

Training all people at once:

14. War Functions

I. Insufficient preparations for war:

School of Computer Science and Engineering 4A21 Page 42


Armed Forces

II. Deploy a Warship:

Warship not found:

School of Computer Science and Engineering 4A21 Page 43


Armed Forces

III. Submerge a submarine:

Submarine not found:

School of Computer Science and Engineering 4A21 Page 44


Armed Forces

IV. Deploy tank:

Tank not found:

School of Computer Science and Engineering 4A21 Page 45


Armed Forces

V. Fly a FighterJet:

FighterJet not found:

School of Computer Science and Engineering 4A21 Page 46


Armed Forces

VI. Fire a gun:

Firing of gun in single and burst mode:

Reloading of the gun:

School of Computer Science and Engineering 4A21 Page 47


Armed Forces

Gun not found:

VII. Throwing Grenade

School of Computer Science and Engineering 4A21 Page 48


Armed Forces

Grenade not found:

School of Computer Science and Engineering 4A21 Page 49

You might also like