You are on page 1of 17

I NTRODUCTION

As it is clear from the name of the title, I have tried to make a program which will provide the
user the facility to calculate emi for a loan given the rate of loan per annum and number of
years for which the loan has been taken. The user will be able to do so with the help of
various menus and sub-menus provided in the program.The program also provides menu to
accept the customer data and store it to the hard disk. It will also keep a record of submitted
documents and the user will also be able to calculate the amount of loan left for payment by
entering the date of taking loan and present date.

1
CONTROL DIAGRAM

This diagram tells the interconnection between various menus and sub-menus.

Customer Data

Documents Detail

Frontscreen Main Menu

EMI Calculation

Exit

This shows the transfer of control between various menus and sub menus.

2
PROJECT SCREENS

1. This is the front screen of program.

2. This is the main menu.

3
3. This screen shows interface to store customer’s data.

4. This screen shows document details.

4
5. This is the screen for emi calculation and calculation of loan left.

5
PROGRAM CODING

1. This is coding for front screen


.....................................................

#include<math.h>
#include<fstream.h>
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<dos.h>
#include"c:\tc\framewor.cpp"
#include"c:\tc\custu.cpp"
#include"c:\tc\emicalu.cpp"
#include"c:\tc\docu.cpp"
#include"c:\tc\mainmenu.cpp"

void main()
{
int i, j;

clrscr();

for (j=0; j<80; j++)


{
cprintf("*");
delay(50);
textcolor(j);
}

for (j=80; j>0; j--)


{
gotoxy(j,24);
cprintf("*");
delay(50);
textcolor(j);

gotoxy(0,2);

for (j=0; j<80; j++)


{
gotoxy(j,2);

6
textcolor(1);
cprintf("=");
delay(50);
}

for (j=80; j>0; j--)


{
gotoxy(j,23);
textcolor(1);
cprintf("=");
delay(50);
}

int x=40;
for(j=7;j<15;j++)
{
textcolor(j);
gotoxy(x,j);
cprintf(".*.");
x-=3;
delay(50);
}

x=40;
for(j=7;j<15;j++)
{
textcolor(j);
gotoxy(x,j);
cprintf(".*.");
x+=3;
delay(50);
}

for(j=15;j<22;j++)
{
gotoxy(x-5,j);
cprintf("I");
delay(50);
}

for(x=61;x>20;x--)
{textcolor(4);
gotoxy(x,j);
cprintf("*");
delay(50);
}

7
x+=3;

for(j=22;j>15;j--)
{
textcolor(14);
gotoxy(x,j-1);
cprintf("I");
delay(50);
}

textcolor(12);
gotoxy(x+8,j);
cprintf("HOME LOAN CALCULATION");
textcolor(13);
delay(50);
gotoxy(x+13,++j);
cprintf("PREPARED BY");
textcolor(14);
delay(50);
gotoxy(x+12,++j);
cprintf("DIWAKER SINGH");
textcolor(17);
delay(50);
gotoxy(x+14,++j);
cprintf("RB1803B54");
mainmenu();

getch();

2. This is coding for main menu


....................................................

void mainmenu(void)
{
l1:
clrscr();
{framework();
int ans;
int x=24,y=5;
gotoxy(x+12,y);
textcolor(5);
cprintf("MAIN MENU");
gotoxy(x,y+2);

8
cprintf("1.ENTER CUSTOMER DATA");
gotoxy(x,y+4);
cprintf("2.DOCUMENTS DETAIL");
gotoxy(x,y+6);
cprintf("3.EMI CALCULATION");
gotoxy(x,y+8);
cprintf("4.EXIT");
gotoxy(x,y+10);
cprintf("ENTER YOUR CHOICE:");
cin>>ans;

do
{
switch(ans)
{
case 1:
customerdata();
goto l1;
case 2:
document();
goto l1;
case 3:
emical();
goto l1;
case 4:
exit(0);
default:
cout<<"invalid choice";
exit(0);
}
}
while(ans!=1||ans!=2||ans!=3);

3. This is coding for customer data


..........................................................

void customerdata(void)
{
class date
{
int month,day,year;

9
public:
void getdate(void)
{
cin>>day>>month>>year;
}
};

class custdata

char cust_name[25];
char address[50];
char mobno[10];
double amt;

public:
date dat;
void getdata(void)
{
textcolor(5);
gotoxy(18,6);

cprintf("ENTER CUSTOMER NAME:");

gotoxy(18,8);
cprintf("ENTER CUSTOMER ADDRESS:");

gotoxy(18,10);
cprintf("ENTER CUSTOMER MOB NO:");

gotoxy(18,12);
cprintf("ENTER LOAN AMOUNT:");

gotoxy(18,14);
cprintf("ENTER DATE OF LOAN(dd/mm/yyyy):");

gotoxy(40,6);
gets(cust_name);
gotoxy(42,8);
gets(address);
gotoxy(40,10);
gets(mobno);
gotoxy(40,12);

10
cin>>(amt);
gotoxy(50,14);
dat.getdate();
}
};

ofstream n;
char ans;
clrscr();
n.open("c:/mypro/custdetail.txt",ios::app);
do
{
clrscr();

framework();

custdata obj;

obj.getdata();

n.write((char*)&obj,sizeof(obj));

gotoxy(15,22);
printf("WANT TO ADD SOME MORE");
ans=getche();
}
while(ans=='y'||ans=='Y');
n.close();
getch();
}

4. This is coding for document details


..............................................................

void document(void)
{

class documents
{
char residence_proof;
char pan_card;
char salary_slip;
char ele_bill;

11
char bnk_stat;

public:
void getdata(void)
{
gotoxy(18,6);

cprintf("RESIDENCE PROOF(Y/N)");

gotoxy(18,8);
cprintf("PANCARD(Y/N)");

gotoxy(18,10);
cprintf("SALARY SLIP(Y/N)");

gotoxy(18,12);
cprintf("ELECTRICITY BILL(Y/N)");

gotoxy(18,14);
cprintf("BANK STATEMENT(Y/N)");

gotoxy(40,6);
cin>>residence_proof;
gotoxy(42,8);
cin>>pan_card;
gotoxy(40,10);
cin>>salary_slip;
gotoxy(40,12);
cin>>ele_bill;
gotoxy(40,14);
cin>>bnk_stat;
}

void approval(void)
{
if
(residence_proof=='y'||'Y'&&pan_card=='y'||'Y'&&salary_slip=='y'||'Y'&&ele_bill=='y'||'
Y'&&bnk_stat=='y'||'Y')
{
gotoxy(18,16);
cprintf("LOAN APPROVED");
}
else
{
gotoxy(18,18);
cprintf("LOAN NOT APPROVED");
}
}
};

12
clrscr();
framework();
documents obj;
obj.getdata();
obj.approval();
getch();

5. This is coding for EMI calculation


............................................................

void emical(void)
{
class date
{
int month,day,year;
public:

void getdate(void)
{
cin>>day>>month>>year;
}

int caldiff(date &d1,date&d2)


{int temp1;
temp1=(((d2.year-d1.year)-1)*12)+((12-d1.month)+d2.month);
return(temp1);
}
};

class emical
{
double principal;
float rate;
int time;
float n;
float r;
double emi;
date d1,d2;
int nom;

public:
void getdata(void)

13
{

gotoxy(18,6);
cprintf("ENTER PRINCIPAL(RS.)");

gotoxy(18,8);
cprintf("ENTER RATE(P.A.)");

gotoxy(18,10);
cprintf("ENTER TIME (YRS)");

gotoxy(18,12);
cprintf("CALCULATED EMI:");

gotoxy(18,16);
cprintf("ENTER DATE OF LOAN:");

gotoxy(18,18);
cprintf("ENTER PRESENT DATE:");

gotoxy(18,20);
cprintf("LOAN LEFT TO PAY:");

gotoxy(40,6);
cin>>principal;
gotoxy(42,8);
cin>>rate;
gotoxy(40,10);
cin>>time;
gotoxy(40,16);
d1.getdate();
gotoxy(40,18);
d2.getdate();

nom=d1.caldiff(d1,d2);

void cal(void)
{
n=(time*12);
r=(rate/12)/100;
emi=(principal*r*(pow((1+r),n)))/(pow((1+r),n)-1);
gotoxy(40,12);
cout<<emi;
}

void loanleft(void)

14
{
gotoxy(50,20);
cout<<(principal-(nom*emi));
}

};

char ans;
do
{
clrscr();
framework();
emical obj;
obj.getdata();
obj.cal();
obj.loanleft();
gotoxy(15,22);
cprintf("WANT TO CALCULATE MORE");
ans=getche();
}
while(ans=='y'||ans=='Y');

getch();
}

6. This is coding for framework


....................................................

void framework(void)
{
int i,j;
i=15,j=4;
for(i;i<=65;i++)
{textcolor(i);
gotoxy(i,j);
cprintf("*");
delay(25);
}

for(j;j<=20;j++)
{textcolor(j);
gotoxy(i,j);
cprintf("*");
delay(25);
}

15
for(i;i>=15;i--)
{textcolor(i);
gotoxy(i,j);
cprintf("*");
delay(25);
}

for(j;j>=4;j--)
{textcolor(j);
gotoxy(i,j);
cprintf("*");
delay(25);
}

16
ABSTRACT

My project includes classes, functions, control structure, file handling etc which are the
basic building blocks of any object oriented programming language. when we run the
program the first screen we encounter is the front screen which I have made colourful by
making the use of textcolor() function and delay() function which are present in conio.h
and dos.h header files respectively. After running the program, control is transferred to
mainmenu() function which has been called by frontscreen program. from the main
menu, we can make various selections depending upon our requirement. for example, if
we want to enter customer data, we will press1 and the corresponding function
customerdata() will be executed. After that, control will again come back to the main
menu depending upon what we enter in the customerdata screen at the end. if we press
‘y’ in the customerdata screen, it will repeat itself, but if we press ‘n’, the control will
come back to the main menu. Similarly, other functions document() and emical() work.
The program will exit if we make a choice of 4 in the main menu.

17

You might also like