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

Narendraadaproject PDF

This document is a project report submitted to Rajasthan Technical University for the degree of Master of Computer Applications. It describes a project on an "ADA LAB MINI PROJECT" completed by student Narendra Singh. The project report includes sections introducing the project, specifying requirements, describing software features through flowcharts, algorithms and program code for three problem statements. It concludes with a bibliography.

Uploaded by

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

Narendraadaproject PDF

This document is a project report submitted to Rajasthan Technical University for the degree of Master of Computer Applications. It describes a project on an "ADA LAB MINI PROJECT" completed by student Narendra Singh. The project report includes sections introducing the project, specifying requirements, describing software features through flowcharts, algorithms and program code for three problem statements. It concludes with a bibliography.

Uploaded by

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

A PROJECT REPORT

ON
“ADA LAB MINI PROJECT”

Submitted to the
RAJASTHAN TECHNICAL UNIVERSITY, KOTA

In partial fulfillment of the requirements for the award of the degree of

MASTER OF COMPUTER APPLICATION

RAJASTHAN TECHNICAL UNIVERSITY, KOTA

Submitted To: Submitted By:


Nilesh Sir Narendra Singh

(HOD, CS Department) MCA V SEM.

Enroll: 18C2RCXXM40P203

REGIONAL COLLEGE FOR EDUCATION RESEARCH AND


TECHNOLOGY, JAIPUR (RAJ.)
(Affiliated to Rajasthan Technical University, Kota)
MCA-(2018-2020)
SELF DECLARATION

This is to certify that the project report entitled “ADA LAB MINI PROJECT” submitted to
Rajasthan Technical University in partial fulfillment of the requirement for the award of the degree
of MASTER OF COMPUTER APPLICATIONS (MCA) Semester-V Paper Code MCA-552, is an authentic
and original work carried out by Mr. Narendra Singh with enrolment no. 18C2RCXXM40P203
under my guidance.

The matter embodied in this project is genuine work done by the student and has not been
submitted whether to this University or to any other University / Institute for the fulfillment of the
requirements of any course of study.

(Narendra Singh)

(MCA V SEM)

Enrolment No: 18C2RCXXM40P203


CERTIFICATION BY EXAMINER

This is to certify that the project report title “ADA LAB MINI PROJECT” submitted
in partial fulfillment for the award of master of computer application program of Rajasthan technical
university, Kota was carried out by Mr. Narendra Singh under my guidance. This has not been
submitted to any other university or institution for the award of any degree/diploma/certificate.

Name and address of the Internal Guide Name and address of the External Guide

……………………………………... …………………………………………

……………………………………… …………………………………………

……………………………………… ………………………………………….

Signature of the Internal Guide Signature of external guide

……………………………………… …………………………………………
TABLE OF CONTENTS
1. Introduction
1.1 Cover Page
1.2 Title Page
1.3 Certificate
1.4 Acknowledgement
1.5 Table of Contents

2. Project Specifications
2.1 Project Overview
2.2 Project Need

3. Specific Requirements

4. Software Product Features


Problem Statement 1
4.1 Flowcharts
4.2 Algorithms
4.3 Snapshots of Programs
4.4 Program Code

Problem Statement 2
4.1 Flowcharts
4.2 Algorithms
4.3 Snapshots of Programs
4.4 Program Code

Problem Statement 3
4.1. Flowcharts
4.2 Algorithms
4.3 Snapshots of Programs
4.4 Program Code
5.Conclusion
6. Bibliography
1. Project Specification

1.1 Project Overview:


This project is based on the different algorithm based on the data structure and other data
analysis and designing algorithms that providesbenefits to the students to develop their
knowledge and practical skills. There are three different small types of projects are there
by different algorithms.

1. Banking Atm System:


Banking Atm System has a unique style of coding and is presented in a colourful
manner. It uses transaction to perform operations such as Cash deposit, Cash
Withdrawal, Balance Inquiry,Pay Bills, Account Interest Payment to manage bank
account’ records. In this project, we can also manage transaction for bank account.

2. Dijkstra’s Shortest Path Algorithm:


The Dijkstra’s shortest path algorithm is the most commonly used to solve the
single source shortest path problem today. For a graph G(V, E), where V is the set
of vertices and E is the set of edges, the running time for finding a path between
two vertices varies when different data structure are used. This project uses binary
heap to implement Dijkstra’s algorithm although there are some data structures
that may slightly improve the time complexity, such as Fibonacci heap that can
purchase time complexity of O(V*log(V)) [6].

3. Minimum Cost Spanning Tree:


This is based on dynamic programming. In this project, given the mobile numeric
keypad to play a game. You can only press buttons that are up, left, right or down
to the current button. You are not allowed to press bottom row corner buttons (i.e.
* and #). So in this project, find out the possible keys which can be pressed.

1.2 Project need

The objectives of the project is to help the student develop the ability to apply theoretical
and practical tools/techniques to solve real life problems related to industry, academic
institutions and research laboratories.
2. Specific Requirements
2.1 User Interface
• Projects are prepared on the basis of data structure, c, data analysis and designing of
algorithms.
• Reports are generated as per the requirements.

2.2 Software Interface


Technology C++

2.3 Hardware Interface


RAM 4.00 GB
Operating System Windows 7 , XP
3. Software Product Features:

Problem Statement 1: Student Record System

3.1. Flow Chart

START

MAIN MENU
Press(D)
Quit Prog.
ENTER YOUR
CHOICE

Press(0), Press(1),Multi
EXIT pal Choice

Cash deposit Withdrawal Bal.Inquiry Pay Bills Quit Prog.


Prog.

PRINT

STOP
3.2 Program code

#include <iostream>
#include <iomanip>
#include <time.h>
#include <fstream>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include<process.h>
#include<dos.h>
using namespace std;
class Bank //abstract base class
{
public:
double startBalance;
string COKAccountHolders;
double limit;
};

class ATMAccountHolders:public Bank


{
string accountHolders;
string accountHoldersAddress, branch;
int accountNumber;
double startBalance;
double accountBalance;
double accountInterest;
double amount;
int count;

public:
//void Display_accountBalance();
void deposit();
void withdraw();
void details();
void payBills();
void accountExit();
void interest();

ATMAccountHolders()
{
accountNumber = 5678;
accountHolders = "Abdallah Abdarahman Ahmed Bashari";
accountHoldersAddress = "Khartoum Omdurman Al-Thawra hara 8 house no.103";
startBalance = 30000.00;
accountBalance = 20000.00;
branch = "Bahri";
amount = 20000;
}
};
void ATMAccountHolders::interest()
{
system("cls");
cout<<"\n==========================ATM ACCOUNT INTEREST
PAYMENT==========================\n\n";
cout<<"\tThe Interest is calculate over the last SIX months on the average
account balance\n";
cout<<"\n\t\tInterest Rate payable is 10% per annum."<<endl;
cout<<"\t\tView the accumulated interest? Press 1 for Yes OR 0 for NO.\n\n";
cout<<"==========================ATM ACCOUNT INTEREST
PAYMENT==========================\n\n";

cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";


cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";
cout<<"\tThe Branch location is :"<<branch<<"\n\n";
cout<<"\tAccount number :"<<accountNumber<<"\n\n";
cout<<"============================+++++++++++++++++++++++=========
===================\n\n";
cout<<"\tStarting account balance :₹"<<startBalance<<"\n\n";
cout<<"\tPresent available balance :₹"<<accountBalance<<"\n\n";
accountInterest=accountBalance+(accountBalance*1.050);
cout<<"\tPresent available balance + interest for 6 months
:₹"<<accountInterest<<"\n\n";
cout<<"Press any key to Return to the Main Menu\n\n";
system("PAUSE");
}
void ATMAccountHolders::deposit()
{
system("cls");
cout<<"\n===========================ATM ACCOUNT DEPOSIT
SYSTEM==========================\n\n";

cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";


cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";
cout<<"\tThe Branch location is :"<<branch<<"\n\n";
cout<<"\tAccount number :"<<accountNumber<<"\n\n";

cout<<"============================+++++++++++++++++++++++=========
===================\n\n";
cout<<"\tStarting account balance :₹"<<startBalance<<"\n\n";
cout<<"\tPresent available balance :₹"<<accountBalance<<"\n\n";
cout<<"\tEnter the Amount to be Deposited ₹";

double amount;
cin>>amount;
accountBalance=startBalance+amount ;
cout<<"\n\tYour new available Balanced Amount is ₹"<<accountBalance<<endl
;
cout<<"\n\t\t\tThank You!\n\n"<<endl;
cout<<"Press any key to Return to the Main Menu\n\n";
system("PAUSE");
}
void ATMAccountHolders::withdraw()//Withdrawal Transactions
{
system("cls");
cout<<"\n============================ATM ACCOUNT
WTHDRAWAL=============================\n\n";

cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";


cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";
cout<<"\tThe Branch location is :"<<branch<<"\n\n";
cout<<"\tAccount number :"<<accountNumber<<"\n\n";
cout<<"============================+++++++++++++++++++++++=========
===================\n\n";
cout<<"\tStarting account balance :₹"<<startBalance<<"\n\n";
cout<<"\tPresent available balance :₹"<<accountBalance<<"\n\n";
cout<<"\tEnter the Amount to be Withdrawn ₹";
double amount;
cin>>amount;
if(amount>accountBalance||amount>9000)//Limit set at ₹9000 maximum after
paying bills
{
system("cls");
cout<<"\n============================ATM ACCOUNT
WITHDRAWAL=============================\n\n";
cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";
cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";
cout<<"\tThe Branch location is :"<<branch<<"\n\n";
cout<<"\tAccount number :"<<accountNumber<<"\n\n";
cout<<"============================+++++++++++++++++++++++=========
===================\n\n";
cout<<"\n\tInsufficient Available Balance in your account.\n\n"<<endl;
cout<<"\t\t\tSorry !!\n"<<endl;
system("PAUSE");
}
else
{
double b;
accountBalance=startBalance-amount ;
system("cls");
cout<<"\n============================ATM ACCOUNT
WTHDRAWAL=============================\n\n";
cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";
cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";
cout<<"\tThe Branch location is :"<<branch<<"\n\n";
cout<<"\tAccount number :"<<accountNumber<<"\n\n";
cout<<"============================+++++++++++++++++++++++=========
===================\n\n";
cout<<"Your new available Balanced Amount is ₹"<<accountBalance<<endl ;
cout<<"Press any key to Return to the Main Menu\n\n";
system("PAUSE");
}

void ATMAccountHolders::payBills()
{
system("cls");
cout<<"\n===========================ATM BILLS PAYMENT
SYSTEM==========================\n";

cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";


cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";
cout<<"\tThe Branch location is :"<<branch<<"\n\n";
cout<<"\tAccount number :"<<accountNumber<<"\n\n";
cout<<"====================++THANK
YOU++============================\n\n";
cout<<"Pay Electric Company electricity bill of ₹2000.00 now?\n\n";
cout<<"\t\tPress 1 for Yes OR Press 0 for No\n\n";
int r;
cin>>r;
if(r=1)
{accountBalance=startBalance-2000;
system("cls");
cout<<"\n===========================ATM BILLS PAYMENT
SYSTEM==========================\n";
cout<<"\n\tYour electricity bill of ₹2000.00 has been paid.\n\n";
cout<<"\tYour account new Available Balanced Amount is
₹"<<accountBalance<<endl ;
cout<<"\n============================+++++++++++++++++++++++========
===================\n\n";
cout<<"Press any key to Return to the Main Menu\n\n";
}
if(r=0)
{
cout<<"\n===========================ATM BILLS PAYMENT
SYSTEM==========================\n\n";
cout<<"\n\n\tExiting Bill Payment System. Thank you!.\n\n";
cout<<"====================++THANK
YOU++============================\n\n";
}
system("PAUSE");
};
void ATMAccountHolders::details()
{
system("cls");

cout<<"\n============================ATM ACCOUNT
DETAILS=============================\n\n";
cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";
cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";
cout<<"\tThe Branch location is :"<<branch<<"\n\n";
cout<<"\tAccount number :"<<accountNumber<<"\n\n";
cout<<"====================++THANK
YOU++============================\n\n";

cout<<"============================+++++++++++++++++++++++=========
===================\n\n";
cout<<"Press any key to Return to the Main Menu\n\n";
system("PAUSE");
}
void ATMAccountHolders::accountExit()
{
system("cls");

cout<<"\n============================ATM ACCOUNT
EXIT=============================\n\n";
cout<<"\n\n\t\tEXITING...........EXITING...............EXITING\n\n";
cout<<"====================++THANK
YOU++============================\n\n";

cout<<"============================+++++++++++++++++++++++=========
===================\n\n";
system("PAUSE");
exit(1);
}
class Limits:public Bank
{
public:
void SetLimit(double NewLimit)
{}

double Getlimit()
{}

};
int main()
{
int e;
ATMAccountHolders p;

system ("Color 1b");


cout<<"\n============================WELCOME TO
ATM==================================\n\n";
cout<<"\t\t\t--------------------\n"<<endl;
//Prompt to show today's date
cout << "\t\tToday's date is: ";
//Show date and time function
time_t now;
time(&now);

printf("%s\n", ctime(&now));;
//Give space for the function of date and time
cout<<"\t\t\t--------------------\n"<<endl;
cout<<"============================WELCOME TO
ATM==================================\n\n";
//============================================================
======================================

cout<<"\tPress 1 and press Enter to Access your account via pin number\n\n";
cout<<"\t\t\t\t\t or \n\n";
cout<<"\tPress 0 and press Enter to get Help.\n\n";

int access;
cin>>access;
switch(access)
{
case 1://pin to access account
system("cls");int i, pin;

cout<<"\n============================ATM ACCOUNT
ACCESS==================================\n\n";
cout<<"\n\nWhat is your account Pin access Number? Only one attempt
allowed.\n\n"<<endl;
cout<<"============================ATM ACCOUNT
ACCESS==================================\n\n";
cin>>pin;

system("cls");

if(pin==12345)

{
system("cls");

do
{
system("cls");
system ("Color 1a");
cout << endl << "\n======================ATM Main Menu
Screen======================\n" << endl << endl;
cout << "\t\tEnter (1) for Cash Deposit" << endl;
cout << "\t\tEnter (2) for Cash Withdrawal" << endl;
cout << "\t\tEnter (3) for Balance Inquiry" << endl;
cout << "\t\tEnter (4) for Pay Bills" << endl;
cout << "\t\tEnter (5) to Account Interest Payment" << endl;
cout << "\t\tEnter (0) to Exit ATM" << endl << endl;
cout << "\tPLEASE ENTER A SELECTION AND PRESS RETURN KEY: \n\n";
cout<<"==========================ATM MAIN
MENU================================\n\n";

cin>>e;
switch(e)
{
case 1:
p.deposit();
break;
case 2:
p.withdraw();
break;
case 3:
p.details();
break;
case 4:
p.payBills();
break;
case 5:
p.interest();
break;
case 0:
p.accountExit();
break;
default:cout<<"Please Enter the Correct Number Choice"<<endl;
}
}while(e!=0);

break;
}

else
{
system("cls");
system("Color 1c");
cout<<"\n===========================THANKS FOR
YOU===========================\n\n";
cout<<"\nYou had made your attempt which failed!!! No More attempts allowed!!
Sorry!!\n\n";
cout<<"===========================THANKS=====================
======\n\n";

system("PAUSE");
exit (1);
}
case 0://pin to access account
system("cls");
cout<<"\n==========================ATM ACCOUNT
STATUS================================\n\n";
cout<<"\tYou must have the correct pin number to access this acount. See
your\n\n";
cout<<"\t bank representative for assistance during bank opening
hours\n\n";
cout<<"\t\tThanks for, your choice today!!\n\n";
cout<<"==========================ATM ACCOUNT
STATUS================================\n\n";
system ("PAUSE");
exit(1);
break;

}
system("PAUSE");
return 0;
};

3.3 Snapshots
Problem Statement 2: Dijkstra’s Shortest Path Algorithm:
3.1 Flow chart

Start
3.2 Algorithm

1. Create cost matrix C[ ][ ] from adjacency matrix adj[ ][ ]. C[i][j] is the cost of going from
vertex i to vertex j. If there is no edge between vertices i and j then C[i][j] is infinity.
2. Array visited[ ] is initialized to zero.
for(i=0;i<n;i++)
3. If the vertex 0 is the source vertex then visited[0] is marked as 1.
4. Create the distance matrix, by storing the cost of vertices from vertex no. 0 to n-1 from the
source vertex 0.
for(i=1;i<n;i++)
distance[i]=cost[0][i];
Initially, distance of source vertex is taken as 0. i.e. distance[0]=0;
5. for(i=1;i<n;i++)
– Choose a vertex w, such that distance[w] is minimum and visited[w] is 0. Mark visited[w]
as 1.
– Recalculate the shortest distance of remaining vertices from the source.
– Only, the vertices not marked as 1 in array visited[ ] should be considered for recalculation
of distance. i.e. for each vertex v
if(visited[v]==0)
distance[v]=min(distance[v],
distance[w]+cost[w][v])

3.3 Program code

C Program on Dijkstra Algorithm for Finding Minimum Distance of Vertices from a Given
Source in a Graph

#include<stdio.h>
#include<conio.h>
#define INFINITY 9999
#define MAX 10

void dijkstra(int G[MAX][MAX],int n,int startnode);

int main()
{
int G[MAX][MAX],i,j,n,u;
printf("Enter no. of vertices:");
scanf("%d",&n);
printf("\nEnter the adjacency matrix:\n");

for(i=0;i<n;i++)
for(j=0;j<n;j++)
scanf("%d",&G[i][j]);

printf("\nEnter the starting node:");


scanf("%d",&u);
dijkstra(G,n,u);
return 0;
}
void dijkstra(int G[MAX][MAX],int n,int startnode)
{
int cost[MAX][MAX],distance[MAX],pred[MAX];
int visited[MAX],count,mindistance,nextnode,i,j;

//pred[] stores the predecessor of each node


//count gives the number of nodes seen so far
//create the cost matrix
for(i=0;i<n;i++)
for(j=0;j<n;j++)
if(G[i][j]==0)
cost[i][j]=INFINITY;
else
cost[i][j]=G[i][j];
//initialize pred[],distance[] and visited[]
for(i=0;i<n;i++)
{
distance[i]=cost[startnode][i];
pred[i]=startnode;
visited[i]=0;
}
distance[startnode]=0;
visited[startnode]=1;
count=1;
while(count<n-1)
{
mindistance=INFINITY;
//nextnode gives the node at minimum distance
for(i=0;i<n;i++)
if(distance[i]<mindistance&&!visited[i])
{
mindistance=distance[i];
nextnode=i;
}

//check if a better path exists through nextnode


visited[nextnode]=1;
for(i=0;i<n;i++)
if(!visited[i])
if(mindistance+cost[nextnode][i]<distance[i])
{
distance[i]=mindistance+cost[nextnode][i];
pred[i]=nextnode;
}
count++;
}

//print the path and distance of each node


for(i=0;i<n;i++)
if(i!=startnode)
{
printf("\nDistance of node%d=%d",i,distance[i]);
printf("\nPath=%d",i);

j=i;
do
{
j=pred[j];
printf("<-%d",j);
}while(j!=startnode);
}
}

3.4 Snapshots
Problem Statement 3: Minimum Cost Spanning Tree
3.1 Flow chart

3.2 Algorithm
This algorithm creates spanning tree with minimum weight from a given weighted graph.
Begin
Create edge list of given graph, with their weights.
Draw all nodes to create skeleton for spanning tree.
Select an edge with lowest weight and add it to skeleton and delete edge from edge list.
Add other edges. While adding an edge take care that the one end of the edge should always
be in the skeleton tree and its cost should be minimum.
Repeat step 5 until n-1 edges are added.
Return.
3.3 Program code
#include<stdio.h>
#include<stdlib.h>
#define infinity 9999
#define MAX 20
int G[MAX][MAX],spanning[MAX][MAX],n;
int prims();
int main()
{
int i,j,total_cost;
printf("Enter no. of vertices:");
scanf("%d",&n);
printf("\nEnter the adjacency matrix:\n");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
scanf("%d",&G[i][j]);

total_cost=prims();
printf("\nspanning tree matrix:\n");

for(i=0;i<n;i++)
{
printf("\n");
for(j=0;j<n;j++)
printf("%d\t",spanning[i][j]);
}

printf("\n\nTotal cost of spanning tree=%d",total_cost);


return 0;
}
int prims()
{
int cost[MAX][MAX];
int u,v,min_distance,distance[MAX],from[MAX];
int visited[MAX],no_of_edges,i,min_cost,j;
//create cost[][] matrix,spanning[][]
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
if(G[i][j]==0)
cost[i][j]=infinity;
else
cost[i][j]=G[i][j];
spanning[i][j]=0;
}

//initialise visited[],distance[] and from[]


distance[0]=0;
visited[0]=1;

for(i=1;i<n;i++)
{
distance[i]=cost[0][i];
from[i]=0;
visited[i]=0;
}
while(no_of_edges>0)
{
//find the vertex at minimum distance from the tree
min_distance=infinity;
for(i=1;i<n;i++)
if(visited[i]==0&&distance[i]<min_distance)
{
v=i;
min_distance=distance[i];
}

u=from[v];
//insert the edge in spanning tree
spanning[u][v]=distance[v];
spanning[v][u]=distance[v];
no_of_edges--;
visited[v]=1;

//updated the distance[] array


for(i=1;i<n;i++)
if(visited[i]==0&&cost[i][v]<distance[i])
{
distance[i]=cost[i][v];
from[i]=v;
}
min_cost=min_cost+cost[u][v];
}
return(min_cost);
}

3.4 Output
Enter no. of vertices:6

Enter the adjacency matrix:


031600
305030
150564
605002
036006
004260

spanning tree matrix:


031000
300030
100004
000002
030000
004200
Total cost of spanning tree=13

4. Conclusion
All the three applications are made by using c or data structure or data analysis and designing
of algorithms. In this we had used different algorithms to gain perfection in projects.All the 3
of them had helped in making flow charts, algorithm, and code etc.

5 . Bibliography
• https://medium.com/@kingrayhan/500-data-structures-and-algorithms-practice-

problems-and-their-solutions-b45a83d803f0

• https://www.techiedelight.com/list-of-problems/

• https://www.hackerrank.com/domains/data-structures

• https://www.tutorialspoint.com/design_and_analysis_of_algorithms/design_and_anal

ysis_of_algorithms_dynamic_programming.htm

• https://www.adacore.com/about-ada

• https://www.makewithada.org/

• http://sandbox.mc.edu/~bennet/ada/examples/

You might also like