Project Format1
Project Format1
On
SUBMITTED BY:
2300031882 Naveen
Dr. U. Haritha
Assistant Professor
KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.
1|Page
DEPARTMENT OF BASIC ENGINEERING SCIENCES
CERTIFICATE
2|Page
ACKNOWLEDGEMENTS
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 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.
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
5. Implementation <pageno>
8. Conclusion <pageno>
5|Page
INTRODUCTION
6|Page
AIM
Advantages:- Title: Stock Exchange Information Base - Advantages and
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.
Disadvantages:
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:
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 4 -Stop
2. *Functions*:
Step 1-Start
Step 10-Stop
3. *Main Function*:
Step 1-Start
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 6 -Stop.
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>
struct Stock {
char symbol[20];
int numShares;
float price;
};
struct Queue {
};
return queue;
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;
strcpy(stock.symbol, symbol);
stock.numShares = numShares;
stock.price = price;
if (isEmpty(queue))
queue->front = 0;
queue->stocks[queue->rear] = stock;
if (isEmpty(queue)) {
printf("Queue is empty\n");
exit(EXIT_FAILURE);
if (queue->front == queue->rear)
else
return stock;
float totalCost = 0;
14 | P a g e
while (numShares > 0 && !isEmpty(queue)) {
if (strcmp(stock.symbol, symbol) == 0) {
numShares -= stock.numShares;
} else {
stock.numShares -= numShares;
numShares = 0;
} else {
if (numShares > 0) {
return -1;
return totalCost;
void displayMenu() {
printf("\nMenu:\n");
15 | P a g e
printf("4. Exit\n");
if (isEmpty(queue)) {
printf("Queue is empty\n");
return;
printf("\nCurrent stocks:\n");
int i = queue->front;
do {
i = (i + 1) % MAX_STOCKS;
int main() {
int choice;
do {
displayMenu();
scanf("%d", &choice);
switch (choice) {
case 1: {
char symbol[20];
int numShares;
float price;
scanf("%d", &numShares);
scanf("%f", &price);
break;
case 2: {
char symbol[20];
int numShares;
scanf("%s", symbol);
scanf("%d", &numShares);
if (fifoPrice != -1)
break;
case 3: {
displayStocks(queue);
break;
case 4: {
printf("Exiting program\n");
17 | P a g e
break;
default:
printf("Invalid choice\n");
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