0% found this document useful (0 votes)
11 views

Project Format1

The document describes a project to create a stock exchange information system using a queue data structure and FIFO accounting. The system allows users to input stock purchase details and retrieve stock prices based on FIFO. It includes sections on the aim, advantages, disadvantages, future enhancements, system requirements, data flow diagram, algorithms and main functions.

Uploaded by

rutwika06
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Project Format1

The document describes a project to create a stock exchange information system using a queue data structure and FIFO accounting. The system allows users to input stock purchase details and retrieve stock prices based on FIFO. It includes sections on the aim, advantages, disadvantages, future enhancements, system requirements, data flow diagram, algorithms and main functions.

Uploaded by

rutwika06
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

K L UNIVERSITY

FRESHMAN ENGINEERING DEPARTMENT


A Project Based Lab Report

On

The Stock Exchange Information Base

SUBMITTED BY:

I.D NUMBER NAME

2300031850 K. Resha sri datta

2300032022 K. Nandini Reddy

2300032140 Ch. Sharon

2300031882 Naveen

UNDER THE ESTEEMED GUIDANCE OF

Dr. U. Haritha

Assistant Professor

KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.

1|Page
DEPARTMENT OF BASIC ENGINEERING SCIENCES

CERTIFICATE

This is to certify that the project based laboratory report entitled


“The Stock Exchange Information Base” submitted by Mr./Ms. K.Nandini Reddy
bearing Regd. No. 2300032022 to the Department of Basic Engineering Sciences,
KL University in partial fulfillment of the requirements for the completion of a project
based Laboratory in ”DATA STRUCTURES-23SC1202” course in I B Tech II
Semester, is a bonafide record of the work carried out by him/her under my supervision
during the academic year 2023– 2024.

PROJECT SUPERVISOR HEAD OF THE DEPARTMENT

Dr. U. HARITHA Dr. D.HARITHA

2|Page
ACKNOWLEDGEMENTS

It is great pleasure for me to express my gratitude to our honorable President Sri.


Koneru Satyanarayana, for giving the opportunity and platform with facilities in
accomplishing the project based laboratory report.

I express the sincere gratitude to our principal Dr. A Jagadeesh for his
administration towards our academic growth.

I express sincere gratitude to our Coordinator Dr. D. Haritha for her leadership
and constant motivation provided in successful completion of our academic semester.

I record it as my privilege to deeply thank our pioneer HOD-BES for providing


us the efficient faculty and facilities to make our ideas into reality.

I express my sincere thanks to our project supervisor U. Haritha for his/her novel
association of ideas, encouragement, appreciation and intellectual zeal which motivated
us to venture this project successfully.

Finally, it is pleased to acknowledge the indebtedness to all those who devoted


themselves directly or indirectly to make this project report success.

2300031850 K. Resha sri datta

2300032022 K. Nandini Reddy

2300032140 Ch. Sharon

2300031882 Naveen

3|Page
ABSTRACT
The Stock Exchange Information Base project aims to create a user-
friendly system for managing stock transactions using the FIFO (First In, First
Out) accounting method. The system allows users to input data regarding stock
purchases, including the stock symbol, number of shares, and purchase price.
Implemented with either an array-based or linked list-based queue structure, the
system enables users to enter new stock information or query existing data. A
menu-driven interface guides users through the process, facilitating tasks such as
entering new stock details and retrieving FIFO and LIFO (Last In, First Out)
prices for a specified stock and share quantity. Through this project, users can
effectively manage and analyze their stock transactions while adhering to FIFO
accounting principles.

4|Page
INDEX

S.NO TITLE PAGE NO


1. Introduction <pageno>

2. Aim of the Project <pageno>


2.1 Advantages & Disadvantages
2.2 Future Implementation
3. Software & Hardware Details <pageno>

4. Data Flow Diagram <pageno>

5. Implementation <pageno>

6. Algorithm for each module <pageno>

7. Integration and System Testing <pageno>

8. Conclusion <pageno>

5|Page
INTRODUCTION

6|Page
AIM
Advantages:- Title: Stock Exchange Information Base - Advantages and

1. *Menu-driven Functionality*: The menu-driven interface provides a user-friendly


way for users to interact with the system, making it easy to input new stock
information and query existing data.

2. *Flexible Data Entry*: Users can easily enter information about various stocks,
including the stock symbol, number of shares, and purchase price. This flexibility
allows for accurate tracking of stock transactions.

3. *FIFO Accounting*: The system utilizes FIFO (First In, First Out) accounting
method, which ensures that the cost of stocks is calculated based on the order they
were purchased. This method is commonly used in accounting and provides a
straightforward way to determine stock prices.

4. *Efficient Queue Implementation*: Whether using an array-based or linked list-


based implementation, the queue data structure efficiently stores and manages stock
transactions. This allows for quick access to data and efficient retrieval of FIFO
prices.

Disadvantages:

1. *Limited to FIFO Method*: While FIFO accounting is useful in many scenarios, it


may not always be the most appropriate method for calculating stock prices. Some
users may require the option to use alternative methods such as LIFO (Last In, First
Out) or specific identification.

2. *Potential for Data Duplication*: In a queue-based implementation, if the same


stock is purchased multiple times, each transaction is stored separately in the queue.
This could lead to data duplication and increased memory usage, especially if large
numbers of transactions are recorded.

3. *Complexity of Implementation*: While the system is designed to be user-friendly,


implementing the queue-based data structure and ensuring correct FIFO calculations
can be complex, especially for users with limited programming experience

4. *Limited Error Handling*: The system may lack robust error handling mechanisms,
which could lead to unexpected behavior or incorrect calculations if users input
invalid data or if the system encounters errors during execution.

Future enhancements:-
7|Page
Future Implementations for the "Stock Exchange Information Base" Project:

1. *User Authentication and Authorization*: Implement user authentication and


authorization mechanisms to ensure that only authorized users can access and
manipulate the stock information. This can include user login functionality with
secure authentication methods like OAuth or token-based authentication.

2. *Database Integration*: Integrate a database backend (such as MySQL,


PostgreSQL, or MongoDB) to store and manage the stock information
persistently. This allows for scalability, data integrity, and efficient querying of
large datasets.

3. *Real-Time Stock Data Integration*: Integrate APIs or services to fetch real-


time stock market data, enabling users to access up-to-date information on stock
prices, trends, and market performance.

4. * Notification System*: Implement a notification system to alert users about


significant changes in their stock investments, such as price fluctuations, dividend
payments, or corporate actions (e.g., mergers, acquisitions). This keeps users
informed and enables timely decision-making.

5. *Visualization Tools*: Implement data visualization tools (e.g., charts, graphs)


to present stock data trends and performance metrics in a visually appealing and
easily understandable format. This enhances user experience and facilitates better
decision-making.

8|Page
SYSTEM REQUIREMENTS

 SOFTWARE REQUIREMENTS:
The major software requirements of the project are as follows:
Language : Turbo-C
Operating system: Windows Xp or later.

 HARDWARE REQUIREMENTS:

The hardware requirements that map towards the software are as follows:

RAM :

Processor :

9|Page
DATA FLOW DIAGRAM

10 | P a g e
ALGORITHM
1. *Data Structures*:

Step 1 -Start

Step 2- struct Stock: Represents a stock item with symbol, number of shares,
and price.

Step 3- struct Queue: Represents a queue of stocks.

Step 4 -Stop

2. *Functions*:

Step 1-Start

Step 2 - createQueue(): Dynamically allocates memory for a new queue and


initializes its front and rear pointers.

Step 3 - isEmpty(): Checks if the queue is empty.

Step 4 - isFull(): Checks if the queue is full.

Step 5- enqueue(): Adds a new stock to the rear of the queue.

Step 6 - dequeue(): Removes a stock from the front of the queue.

Step 7 - findFIFOPrice(): Finds the total cost of purchasing a certain number


of shares of a stock using the FIFO method.

Step 8- displayMenu(): Displays the menu options for the user.

Step 9 - displayStocks(): Displays the current stocks in the queue.

Step 10-Stop

3. *Main Function*:

Step 1-Start

Step 2- Initializes the queue.

Step 3 - Displays a menu for the user to interact with the program.

Step 4- Based on the user's choice, it performs actions such as adding a new
stock, finding FIFO price for a stock, displaying current stocks.

11 | P a g e
Step 5-Stop.

4. *Menu Options*:

Step 1-Start

Step 2- Add a new stock by providing its symbol, number of shares, and price.

Step 3- Find the FIFO price for a specific stock symbol and a given number of
shares.

Step 4- Display the current stocks in the system.

Step 5- Exit the program.

Step 6 -Stop.

5. *Exiting the Program*:

Step 1-Start

Step 2 - The program continues to display the menu and accept user input until
the user chooses to exit (option 4).

Step 3 - Memory allocated for the queue is freed before exiting the program.

Step 4- Stop.

12 | P a g e
IMPLEMENTATION
#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#define MAX_STOCKS 100

struct Stock {

char symbol[20];

int numShares;

float price;

};

struct Queue {

struct Stock stocks[MAX_STOCKS];

int front, rear;

};

struct Queue* createQueue() {

struct Queue* queue = (struct Queue*)malloc(sizeof(struct Queue));

queue->front = queue->rear = -1;

return queue;

int isEmpty(struct Queue* queue) {

return (queue->front == -1);

int isFull(struct Queue* queue) {

return ((queue->rear + 1) % MAX_STOCKS == queue->front);

void enqueue(struct Queue* queue, char* symbol, int numShares, float price) {
13 | P a g e
if (isFull(queue)) {

printf("Queue is full\n");

return;

struct Stock stock;

strcpy(stock.symbol, symbol);

stock.numShares = numShares;

stock.price = price;

if (isEmpty(queue))

queue->front = 0;

queue->rear = (queue->rear + 1) % MAX_STOCKS;

queue->stocks[queue->rear] = stock;

struct Stock dequeue(struct Queue* queue) {

if (isEmpty(queue)) {

printf("Queue is empty\n");

exit(EXIT_FAILURE);

struct Stock stock = queue->stocks[queue->front];

if (queue->front == queue->rear)

queue->front = queue->rear = -1;

else

queue->front = (queue->front + 1) % MAX_STOCKS;

return stock;

float findFIFOPrice(struct Queue* queue, char* symbol, int numShares) {

float totalCost = 0;

14 | P a g e
while (numShares > 0 && !isEmpty(queue)) {

struct Stock stock = dequeue(queue);

if (strcmp(stock.symbol, symbol) == 0) {

if (stock.numShares <= numShares) {

totalCost += stock.numShares * stock.price;

numShares -= stock.numShares;

} else {

totalCost += numShares * stock.price;

stock.numShares -= numShares;

enqueue(queue, stock.symbol, stock.numShares, stock.price);

numShares = 0;

} else {

enqueue(queue, stock.symbol, stock.numShares, stock.price);

if (numShares > 0) {

printf("Insufficient shares available for FIFO calculation\n");

return -1;

return totalCost;

void displayMenu() {

printf("\nMenu:\n");

printf("1. Enter a new stock\n");

printf("2. Find the FIFO price for a stock\n");

printf("3. Display current stocks\n");

15 | P a g e
printf("4. Exit\n");

void displayStocks(struct Queue* queue) {

if (isEmpty(queue)) {

printf("Queue is empty\n");

return;

printf("\nCurrent stocks:\n");

int i = queue->front;

do {

printf("Symbol: %s, Shares: %d, Price: $%.2f\n", queue->stocks[i].symbol, queue-


>stocks[i].numShares, queue->stocks[i].price);

i = (i + 1) % MAX_STOCKS;

} while (i != (queue->rear + 1) % MAX_STOCKS);

int main() {

struct Queue* queue = createQueue();

int choice;

do {

displayMenu();

printf("Enter your choice: ");

scanf("%d", &choice);

switch (choice) {

case 1: {

char symbol[20];

int numShares;

float price;

printf("Enter stock symbol: ");


16 | P a g e
scanf("%s", symbol);

printf("Enter number of shares: ");

scanf("%d", &numShares);

printf("Enter price: ");

scanf("%f", &price);

enqueue(queue, symbol, numShares, price);

printf("Stock added successfully\n");

break;

case 2: {

char symbol[20];

int numShares;

printf("Enter stock symbol: ");

scanf("%s", symbol);

printf("Enter number of shares: ");

scanf("%d", &numShares);

float fifoPrice = findFIFOPrice(queue, symbol, numShares);

if (fifoPrice != -1)

printf("FIFO price for %s with %d shares: $%.2f\n", symbol, numShares,


fifoPrice);

break;

case 3: {

displayStocks(queue);

break;

case 4: {

printf("Exiting program\n");
17 | P a g e
break;

default:

printf("Invalid choice\n");

} while (choice != 4);

free(queue);

return 0;

18 | P a g e
INTEGRATION AND SYSTEM TESTING
OUTPUTS
Screen Shots:

19 | P a g e
20 | P a g e
21 | P a g e
CONCLUSION
The Stock Exchange Information Base project offers a robust
solution for managing stock transactions with a FIFO accounting approach.
Implemented using C, it employs a queue data structure to store stock
information efficiently. Through a menu-driven interface, users can input stock
details, query FIFO prices, and view current stocks. Error handling ensures
smooth execution even in cases of full or empty queues. With clear prompts and
user-friendly functionalities, the program facilitates seamless interaction. This
project showcases fundamental concepts of data structures and user input
handling, serving as a practical tool for individuals interested in stock
management. While offering a solid foundation, future iterations could explore
enhancements like extended error checking and support for multiple queues,
enriching its functionality and usability further.

22 | P a g e

You might also like