Вы находитесь на странице: 1из 25

c

ccccccccccccccccccccccc c 
 c

c

 c c ccccccccccccccccccccccccccccccccccccccc

 cc ccccccccccccccccccccccccccccccccccc

c
c

c !cccccccccccccccccccccccccccccccccccccc"#c$
%c

&'( c ) % %*cccccccccccccccccccccccccccccc&+,*c
cccccccccccccccccccc

c
c
ñ  
c

Haskell is a modern ``purely functional'' programming language. A functional language is one in


which functions are as easy to manipulate as the more common kinds of values, such as numbers
and strings. By being purely functional, Haskell does not allow the operations which make
functions difficult to work with in traditional imperative languages: assignment to global
variables or reference parameters. As a result, calling a function will not have any ``side-effects''-
-that is, it will not change the values of any non-local variables--and we are free to treat them as
pure functions.

The advantage of Haskell lies in the fact that it enables programmers to be more productive and
write shorter, clearer, and more maintainable code. Unfortunately, industry practice has not yet
embraced functional programming, in part because of the enormous effort it would take to retrain
current programmers and redesign all the support tools.

Objective-

The main objective is to implement a system that minimizes the processing time of the
employees of the bank by making core functionalities paper free. Present time there are many
banking software system available in the market but they are not so much effective as user
prospects in the terms of cost, speed, ease of use, proper interface, user-friendly etc. Proposed
system is very simple in terms of use any novice and casual user can also use this system easily.
Developed in pure functional programming, this system shall provide coding benefits but has a
few limitations, primarily due to lack of scope of the module.

c c

c
c
Æ  c

It¶s a well known fact that the productivity and the success of an organization depend
substantially on its technology the higher and effective technology drives any organization. The
better the technology better are the prospects for the organisation. In this fast and furious world
where every manual work is shifted towards computer work. And the time has become more
precious than money. People desire instant output from system. and maximum system¶s output
based on its software system. Means how fast and accurate data we can access using the system.
This bank management software system is developed to avoid these things. So this software
would be suggesting the best result which would take less amount of time.


cc

The main objective to implement such software is to minimize the processing time of the
employee of the bank by getting an efficient and accurate result. Present time there are many
banking software system are available in the market but they are not so much effective as user
prospects in the terms of cost, speed, ease of use, proper interface, user-friendly etc. proposed
system is very simple in terms of use any novice and casual user can also use this system easily
after getting/understanding some instructions and one more advantage is it¶s cost is not very high
in terms of maintenance and redevelopment.

  
cc

this project mainly specifies to develop a simple banking application using Haskell for
Functional Programming Concepts and Prolog for Logic Programming Concepts.As prolog
application system specifies to Create a set of Prolog rules which, given a set of basic facts
about a family tree, and to define family relationships through bloodlines.

As project specification there are 5 modules in Haskell application:-

‰c 6  c  
c 
Inc thisc module user can check the details of his/her account in terms of
account ID, account number, name, gender and current balance in the account.c

c
c
‰c 0c 
Inc this module user can deposit any amount of money in his/her account or
other¶s account.c
‰c 0c
In this module user can send/transfer any amount of money to another¶s
account in other case if there is no selected money in the account of the user then he/she is
unable to transfer money. for example if any user wants to transfer 5000/- rupees from his/her
account but there is only 2000/- rupees in his/her account then in this case he/she cannot transfer
the money.
‰c 0c
In thiscmodule user can withdraw any amount of money from his/her account
in other case if there is no sufficient balance is available in his/her account which he/she wants to
withdraw then he/she cannot withdraw money.c
‰c 6
cc 
In this module user can create a new account in the bank.

 
 The following are the list of those cc
c  that
required for developing and running the system -c


c 
cccc

åc üin hugs
åc Swi-Prologc

c 
c

Processor: Preferably 1.0 GHz or Greater.

RAM : 128 MB or Greaterwc

ccc

1.c 

Haskell is a modern, standard, non-strict, purely-functional programming language. It


provides all the features including polymorphic typing, lazy evaluation and higher-order
functions. It also has an innovative type system which supports a systematic form of
overloading and a module system. It is specifically designed to handle a wide range of

c
c
applications, from numerical through to symbolic. To this end, Haskell has an expressive
syntax, and a rich variety of built-in data types, including arbitrary-precision integers and
rationales, as well as the more conventional integer, floating-point and Boolean types.
There are a number of compilers and interpreters available. First-time users may want to
start with Hugs, a small, portable Haskell interpreter. Haskell was named after the
logician Haskell B. Curry. Curry, together with Alonzo Church, laid the foundations of
functional computation in the era Before the Computer, around 1940. As a functional
programming language, Haskell is a member of the Lisp family. Others family members
are Scheme, ML, Occam, Clean. Haskell98 is intended as a standard for lazy functional
programming. Lazy functional programming is a programming style where arguments are
evaluated only when the value is actually needed.

[
c c

C, Java, Pascal, and so on, are all imperative languages. They are "imperative" in the sense that
they consist of a sequence of commands, which are executed strictly one after the other. Haskell
is a functional language. A functional program is a single expression, which is executed by
evaluating the expression.

Anyone who has used a spreadsheet has experience of functional programming. In a spreadsheet,
one specifies the value of each cell in terms of the values of other cells. The focus is on what is
to be computed, not how it should be computed. The advantages of functional programming are:

Ac ©ase of understanding
Ac do core dumps
Ac Codes re-use
Ac Strong glue
Ac Powerful abstractions
Ac Built-in memory management

ñ
ccc

Xc Substantially increased programmer productivity.

c
c
Xc Shorter, clearer, and more maintainable code.
Xc Fewer errors, higher reliability.
Xc A smaller "semantic gap" between the programmer and the language.
Xc Shorter lead times.

Haskell is a wide-spectrum language, suitable for a variety of applications. It is particularly


suitable for programs which need to be highly modifiable and maintainable.

3 
Prolog is a non-procedural logic based language. Prolog involves building up a knowledge base
(database) where relationships are represented. Prolog then uses a built-in facility in order to
draw logical conclusions from a user's inputs. Prolog has its roots in formal logic, and unlike
many other programming languages, Prolog is declarative: The program logic is expressed in
terms of relations, represented as facts and rules. A computation is initiated by running
a query over these relations. The language was first conceived by a group around Alain
Colmerauer in Marseille, France, in the early 1970s and the first Prolog system was developed in
1972 by Colmerauer with Philippe Roussel.

ñ
c

Xc Logic based languages are able to represent the real world more accurately.
Xc Prolog is able to derive new rules from the existing rules contained within the knowledge
base.

cc

0cc c c
c  
cc
c

0c üelcome Page

 c6c

module Start where

c
c
import CreateAccount

import Checkbal

import Deposit

import Trans

import üithdraw

main::IO()

main = do

putStrLn " ****** üelcome To BAd MAdAG©M©dT SYST©M ****** "

putStrLn " 1. Create an Account." --Press 1 to create an account--

putStrLn " 2. Check Balance." --Press 2 to check the balance--

putStrLn " 3. üithdraw Ammount." --Press 3 to withdraw the amount--

putStrLn " 4. Deposit Ammount." --Press 4 to deposit the amount--

putStrLn " 5. Money Transfer." --Press 5 for money transfer--

putStrLn " "

putStrLn " "

putStr " ©nter your Choice: "

choice<- getLine

menu choice

menu :: String -> IO ()

menu choice = case choice of

"1" -> account

"2" -> bal

c
c
"3" -> with

"4" -> depo

"5" -> tran

"0" -> main

_ ->do

putStrLn "Invalid Input..!!!! Please Try Again.!!"

©
 üorking of this module-

Xc Display startup page on the screen.


Xc Text based user friendly menu and choice of options for user.
Xc On choice making of user it will be forwarded to other section of application.
Xc Use of higher order function.

0c Create Account

 c6c

module CreateAccount where

account :: IO()

account = do

as<-readFile "rahul.txt" --Database named rahul--

let as1 = length (func as)

putStrLn " ©nter your dame : " --write your name--

a<-getLine

c
c
putStrLn " ©nter your Address :" --write your address--

b<-getLine

putStrLn " ©nter your Gender :" --write your gender m/f--

c<-getLine

putStrLn " ©nter Balance :" --enter minimum balance to deposit--

d<-getLine

let d1 = read d:: Int

e<-readFile "rahul.txt" --entries comes in database--

let e1 = func e

let e2= e1 ++ [(as1+1,a,b,c,d1)]

writeFile "rahul.txt" (show e2)

func :: String -> [(Int,String,String,String,Int)]

func x =read x::[(Int,String,String,String,Int)]

©
üorking of this module:

Xc Add new customers by filling details of customer.


Xc Data takes as input in list of tuples.
Xc Automatically generate customer account ID.

0c Check balance

 c6

module Checkbal where

c
c
bal :: IO()

bal = do

x<-readFile "rahul.txt"

let x1 = func1 x

putStr " ©nter Account dumber : " --write your account number--

y<-getLine

let y1 = read y:: Int

let in2 = [(a,b,c,d,e)|(a,b,c,d,e)<-x1, a == y1]

let in3 = head in2

if(in2 == []) then do

putStrLn " "

putStrLn "Account dumber Doesnot ©xist..!!!! " -- display massage when entered account no
does not match to any account number of data base--

else do

let z = func in3

putStr " Your Account Balance is :" --your current account balance--

putStrLn (show z)

func :: (Int,String,String,String,Int)->Int

func (a,b,c,d,e) = e

func1 :: String -> [(Int,String,String,String,Int)]

func1 x =read x::[(Int,String,String,String,Int)]

©
 üorking of this module-

Xc It gives the information about current balance.

c

c
Xc It matches the customer ID of data base and entered customer ID by user if they not
match it shows a massage that record is not found.

0c withdraw

 c6cc

module üithdraw where

with :: IO()

with = do

putStrLn "©nter Account dumber : " --write your account number--

x<-getLine

let x1=read x :: Int

a<-readFile "rahul.txt" --data base matches account no--

let a1 = func a

let q = [(a,b,c,d,e)|(a,b,c,d,e)<-a1,a == x1]

let q1 = head q

let g = func1 q1

putStrLn "©nter the amount to be üithdrawn : " --write the amount to be withdraw--

z<-getLine

let z1=read z :: Int

if(z1>g) then do

putStrLn "Money Cannot be üithdrawn..!!" --display massage in the case of available


amount<withdrawal amount--

else do

let f = g - z1

c
c
let qw = func2 q1 f

let qw1 = func3 qw

let c = [(a,b,c,d,e)|(a,b,c,d,e)<-a1,a/=x1]

let d1 = c ++ qw1

writeFile "rahul.txt" (show d1)

func :: String -> [(Int,String,String,String,Int)]

func x =read x::[(Int,String,String,String,Int)]

func1 :: (Int,String,String,String,Int)->Int

func1 (a,b,c,d,e) = e

func2 :: (Int,String,String,String,Int) -> Int -> (Int,String,String,String,Int)

func2 (a,b,c,d,e) x = (a,b,c,d,x)

func3 :: (Int,String,String,String,Int) -> [(Int,String,String,String,Int)]

func3 (a,b,c,d,e) = [(a,b,c,d,e)]

©
 üorking of this module-

Xc Allows user to withdraw money from his/her account.


Xc Check available balance and withdrawal balance if available balance <withdrawal
balance, it gives massage insufficient balance.

0c Deposit

 c6

depo :: IO()

depo = do

putStr " ©nter Account dumber : "

x<-getLine

c
c
let y = read x:: Int

in11<-readFile "rahul.txt" --database--

let in1 = func in11

let in2 = [(a,b,c,d,e)|(a,b,c,d,e)<-in1, a == y]

let in3 = head in2

let g = func1 in3

putStr " ©nter Ammount to be deposit : " --write amount here --

z<-getLine

let y1 = read z:: Int

let u = g + y1

let in4 = func2 in3 u

let in41 = func3 in4

putStr" Amount after Deposit is : " --new account balance(last


amount+deposited amount)--

putStrLn (show (func1 in4))

let in5 = [(a,b,c,d,e)|(a,b,c,d,e)<-in1, a /= y]

let in6 = in5 ++ in41

writeFile "rahul.txt" (show in6) --new database entry--

func :: String -> [(Int,String,String,String,Int)]

func x =read x::[(Int,String,String,String,Int)]

func1 :: (Int,String,String,String,Int)->Int

func1 (a,b,c,d,e) = e

func2 :: (Int,String,String,String,Int) -> Int -> (Int,String,String,String,Int)

func2 (a,b,c,d,e) x = (a,b,c,d,x)

c
c
func3 :: (Int,String,String,String,Int) -> [(Int,String,String,String,Int)]

func3 (a,b,c,d,e) = [(a,b,c,d,e)]

©
 üorking of this module-

Xc It allows user to deposit money in any account using account ID.


Xc If account deposit successfully completed the deposited amount will be automatically
added to available balance.

0c Transfer

 c6c

module Trans where

tran:: IO ()

tran = do

putStr " ©nter the account number from where Money will be transfered : " --source account no-
-

x<-getLine

let x1 = read x::Int

putStr " ©nter the account number where Money will be transfered to : " --destination
account no--

y<-getLine

let y1 = read y::Int

putStrLn " "

putStr " ©nter the Ammount to be transfered : "

z<-getLine

let z1 = read z::Int

c
c
func21 y1 z1

func11 y1 x1 z1

func11::Int->Int-> Int->IO()

func11 x y y1 = do

in11<-readFile "rahul.txt"

let in1 = func in11

let in21 = [(a,b,c,d,e)|(a,b,c,d,e)<-in1, a == x]

let in31 = head in21

let g1 = func1 in31

if(g1 < y1) then do

putStrLn" You Balance is Low " --display massage when available balance in source account is
less than amount to be transfer--

else do

let in2 = [(a,b,c,d,e)|(a,b,c,d,e)<-in1, a == y]

let in3 = head in2

let g = func1 in3

let u = g + y1

let in4 = func2 in3 u

let in41 = func3 in4

putStr" Amount after withdraw of Money is in Account dumber "


--new amount in source account--

putStr (show y)

putStr" is : "

c
c
putStrLn (show (func1 in4))

let in5 = [(a,b,c,d,e)|(a,b,c,d,e)<-in1, a /= y]

let in6 = in5 ++ in41

writeFile "rahul.txt" (show in6) --database is updated--

func21 :: Int->Int->IO()

func21 y y1 = do

in11<-readFile "rahul.txt"

let in1 = func in11

let in2 = [(a,b,c,d,e)|(a,b,c,d,e)<-in1, a == y]

let in3 = head in2

let g = func1 in3

if(g < y1) then do

putStrLn " "

putStrLn " Money Cannot Be Transfered"

else do

let u = g - y1

let in4 = func2 in3 u

let in41 = func3 in4

putStrLn " "

putStr" Amount after Deposit of Money is in Account dumber "


--new balance in destination account--

putStr (show y)

putStr" is : "

c
c
putStrLn (show (func1 in4))

let in5 = [(a,b,c,d,e)|(a,b,c,d,e)<-in1, a /= y]

let in6 = in5 ++ in41

writeFile "rahul.txt" (show in6)

func :: String -> [(Int,String,String,String,Int)]

func x =read x::[(Int,String,String,String,Int)]

func1 :: (Int,String,String,String,Int)->Int

func1 (a,b,c,d,e) = e

func2 :: (Int,String,String,String,Int) -> Int -> (Int,String,String,String,Int)

func2 (a,b,c,d,e) x = (a,b,c,d,x)

func3 :: (Int,String,String,String,Int) -> [(Int,String,String,String,Int)]

func3 (a,b,c,d,e) = [(a,b,c,d,e)]

©
 üorking of this module-

Xc It transfer money from one account to another account and automatically changes the
values of both account.

c
c
 c 
cc0c0c


c c

c
c
6  c  cc c

6
cñ 
c0c

c
c
ü
c0c

c0c

c

c



Testing is the process of exercising software with the intent of finding and correcting errors. This
fundamental doesn¶t change for the stand alone systems but the search for the errors is a
significant challenge for the software engineers due to the complex nature of the system. Testing
is

Xc A process of finding errorc


Xc Finding Undiscovered errorc

!
c 
"c

Unit testing is a testing in which the individual units of the software are tested in isolation
from other parts of a program. It is type of testing for which we test the all type of the module
that is working according to need or not.

ñ
"c

Xc To catch the defects that occurs at the early stage of software development.
Xc To minimize the ration of defects before moving to next level.

#

c 
"cc

Xc Integration is a systematic approach to building the complete software structure specified


in the design from unit-tested modules.
Xc Integration plan must specify the order in which the modules are integrated.

c
 c

cccñ 
c

0c
c c 
c  cc 
c 
c 
c 
cc

c c c [c c

Create account Rahul umar c Unit Testing

üithdraw Rahul umar c c Unit Testing

Deposit Rahul umar c c Unit Testing

Transfer Rahul umar c c Unit Testing

Check Balance Rahul umar c c Unit Testing

Full System Rahul umar c c Integration Testing

 

c$c

There are many limitations in this application which can cause the failure of present system the
main limitation of this project is ,there is no c 
module in this application it can
cause many problems for user for example if user want to modify his/her name, address, phone
number in his/her account detail then it is not possible, the another problem is there is c
c
 
option in this application another problems are there is c

c c% 
c

 cc
c 
c
 %c
c  used in this application.

[
c©   
c

cTo make this application more reliable and secure it is important to implement security, modify
and delete option in the application.c

c
c
c

[
c

father(Rahul,Ram).
father(Rahul,Shewta).
father(Abhishak,Raju).
father(Abhishak,Deepti).
father(Ram, undan).

father(Ram,Rashmi).
father(Raju,ditin).
father(Raju,Sneha).

mother(Akshita,Ram).
mother(Akshita,Shewta).

mother(Arinita,Raju).
mother(Arinita,Deepti).
mother(Deepti, undan).
mother(Deepti,Rashmi).
mother(Shweta,ditin).
mother(Shweta,Sneha).

male(Rahul).
male(Abhishak).
male(Ram).
male(Raju).
male( ndanu).

male(ditin).

c
c
female(Akshita).
female(Arinita).
female(Shweta).
female(Deepti).

female(Rashmi).
female(Sneha).
c

brother(X,Y):-male(X),father(F,X),father(F,Y),X\==Y.
sister(X,Y):-female(X),father(F,X),father(F,Y),X\==Y.
son(X,Y):-(father(Y,X);mother(Y,X)),male(X).
daughter(X,Y):-(father(Y,X);mother(Y,X)),female(X).

children(X,Y):-father(Y,X);mother(Y,X).
uncle(X,Y):-brother(X,F),father(F,Y).
parent(X,Y):-father(X,Y);mother(X,Y).
wife(X,Y):-father(Y,C),mother(X,C),x \= Y.
grandfather(X,Y):-father(X,S),father(S,Y),male(X).
grandmother(X,Y):-mother(X,S),father(S,Y),female(X).
brother-in-law(X,Y):-brother(X,ü),wife(ü,Y).

sister-in-law(X,Y):-sister(X,ü),wife(ü,Y).

c
&!©#©c$cc
brother(X,Y)
sister(X,Y)
son(X,Y)

daughter(X,Y)
children(X,Y)
uncle(X,Y)

c
c
parent(X,Y)
wife(X,Y)
grandfather(X,Y)
grandmother(X,Y)

brother-in-law(X,Y)
sister-in-law(X,Y)

c 


Throughout the development of the project the primary concern is to study the Haskell and
Prolog thoroughly. It will also help in understanding the blood relationship model and functional
programming language. Combining these two things and giving a fruitful result it was
accomplished by a good knowledge. So I have to pay attention on each and every part of Haskell
and Prolog.

6  Before completing the project I would like to conclude that, designing and
developing a bank management system was a real learning experience for me. The principles of
Haskell and Prolog were well implemented throughout the system. The whole project phase was
full of enthusiasm and joyous moments. I have successfully developed programs as required by
the project and have imparted all of the efforts to submit the project on time.

cc

c
c

Вам также может понравиться