Narendraadaproject PDF
Narendraadaproject PDF
ON
“ADA LAB MINI PROJECT”
Submitted to the
RAJASTHAN TECHNICAL UNIVERSITY, KOTA
Enroll: 18C2RCXXM40P203
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)
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
……………………………………... …………………………………………
……………………………………… …………………………………………
……………………………………… ………………………………………….
……………………………………… …………………………………………
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
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
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.
START
MAIN MENU
Press(D)
Quit Prog.
ENTER YOUR
CHOICE
Press(0), Press(1),Multi
EXIT pal Choice
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;
};
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\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";
void ATMAccountHolders::payBills()
{
system("cls");
cout<<"\n===========================ATM BILLS PAYMENT
SYSTEM==========================\n";
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;
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])
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
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]);
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]);
}
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;
3.4 Output
Enter no. of vertices:6
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/