These are the projects I have worked on-

A BREIF DESCRIPTION...

This project can be used by schools/ universities to keep a record of their students and their grades.
There are two data files (binary) included in this project,
  1. Student File with following record structure:
    • Admission Number
    • Roll Number
    • Class
    • Section
    • Name of the student
    • Sex
    • Date of birth
    • Mother’s name
    • Father's name
    • Phone
    • Stream Code
  2. Result File (s) with the following record structure
    • Admission Number
    • Roll Number
    • Student Name
    • Name, Marks and Grade of 5 subjects
    • Total and Average Marks
Operations carried out in this project-
  1. Addition, Modification and Deletion of record in/from Student File
  2. Automatic Admission Number generation
  3. Marks Entry (Sub1, Sub2, Sub3, Sub4, Sub5) of each student. Class, Sec, Name, Stream fields should be taken from Student File just by specifying Admission Number of the student
  4. Result preparation in the result file
    • Calculate and replace Total field of each record as Total = Sub1+Sub2+Sub3+Sub4+Sub5
    • Calculate and replace Avg field of each record as Avg = Total/5
    • Find division of each student with the help of the following conditions:
      If Marks in all five subjects>=33
      If Total>=60 Div="I": First Division
      If Total>=50 and Total<60 Div="II": Second Division
      Else
      If Marks in any one Subject<33
      Div="CO": Compartmental
      Else
      Div="FA" : Failed
      Endif
      Endif
  5. Searching and viewing result and other details of a student with key field ANo
  6. Reports (on screen/printer)
    • Stream-wise Personal information of each student
    • Stream-wise Result List
    • Stream-wise Merit List
    • Marks Sheet of each student
validations:
  1. Automatic generation of Admission Number
  2. Validations of inputted date
  3. Validations of inputted marks
#include<fstream.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<ctype.h>
#include<conio.h>
class date
{
int dd,mm,yy;
char datestr[11];
int checkdate();
public:
char* date2str()
{
sprintf(datestr,"%04i/%02i/%02i",yy,mm,dd);
return datestr;
}
void indate();
void outdate()
{
printf("%02i-%02i-%04i\n",dd,mm,yy);
}
};

int date::checkdate()
{
int maxdays[]={31,28,31,30,31,30,31,31,30,31,30,31};
if ((yy%100!=0 && yy%4==0) || yy%400==0) maxdays[1]=29;
if (mm>=1 && mm<=12)
{
if (dd>=1 && dd<=maxdays[mm-1] && yy>=1980 && yy<=2007)
return 1;
else
return 0;
}
else
return 0;
}

void date::indate()
{
int valid;
do
{
cout<<"Enter Day [1-31] ? ";
cin>>dd;
cout<<"Enter Month [1-12] ? ";
cin>>mm;
cout<<"Enter Year [>=1980]? ";
cin>>yy;
valid=checkdate();
if (valid==0)
cout<<"Invalid date. Input again.\n";
}
while(valid==0);
}

class student
{
int admno;
int clas;
char sec;
char name[20];
date dob;
char fatname[20];
char motname[20];
char add[75];
int pincode;
char sex;
char sub1[20], sub2[20], sub3[20], sub4[20], sub5[20];
int marks1, marks2, marks3, marks4, marks5;
int total;
double average;
char division[10];
public:
void inputmarks()
{
cout<<"Enter marks in "< cin>>marks1;
cout<<"Enter marks in "< cin>>marks2;
cout<<"Enter marks in "< cin>>marks3;
cout<<"Enter marks in "< cin>>marks4;
cout<<"Enter marks in "< cin>>marks5;
total=marks1+marks2+marks3+marks4+marks5;
average=total/5.0;
if (total>=300)
strcpy(division,"FIRST");
else
if (total>=250)
strcpy(division,"SECOND");
else
if (total>=165)
strcpy(division,"THIRD");
else
strcpy(division,"FAIL");
}
void inputaddress()
{
cout<<"Enter address : ";
gets(add);
strupr(add);
cout<<"Enter pincode number : ";
cin>>pincode;
}
void inputdata(int rn)
{
clrscr();
admno=rn;
cout<<"Enter student name : ";
gets(name);
strupr(name);
cout<<"Enter class [11/12] : ";
cin>>clas;
cout<<"Enter section [A-D] : ";
cin>>sec;
sec=char(toupper(sec));
cout<<"Enter sex [M/F] : ";
cin>>sex;
sex=char(toupper(sex));
cout<<"Enter date of birth : ";
dob.indate();
cout<<"Enter father name : ";
gets(fatname);
strupr(fatname);
cout<<"Enter mother name : ";
gets(motname);
strupr(motname);
inputaddress();
int code;
cout<<"1. Science with Economics\n";
cout<<"2. Science with Computer Science\n";
cout<<"3. Science with Biology\n";
cout<<"4. Commerce with Mathematics\n";
cout<<"5. Commerce without Mathematics\n";
cout<<"6. Humanities (Arts)\n";
cout<<"Enter Stream Code : ";
cin>>code;
if(code==1)
{
strcpy(sub1,"English");
strcpy(sub2,"Mathematics");
strcpy(sub3,"Physics");
strcpy(sub4,"Chemistry");
strcpy(sub5,"Economics");
}
else
if(code==2)
{
strcpy(sub1,"English");
strcpy(sub2,"Mathematics");
strcpy(sub3,"Physics");
strcpy(sub4,"Chemistry");
strcpy(sub5,"Computer Science");
}
else
if(code==3)
{
strcpy(sub1,"English");
strcpy(sub2,"Mathematics");
strcpy(sub3,"Physics");
strcpy(sub4,"Chemistry");
strcpy(sub5,"Biology");
}
else
if(code==4)
{
strcpy(sub1,"English");
strcpy(sub2,"Mathematics");
strcpy(sub3,"Economics");
strcpy(sub4,"Accountancy");
strcpy(sub5,"Business Studies");
}
else
if(code==5)
{
strcpy(sub1,"English");
strcpy(sub2,"Economics");
strcpy(sub3,"Accountancy");
strcpy(sub4,"Business Studies");
strcpy(sub5,"Informatics Prac");
}
else
{
strcpy(sub1,"English");
strcpy(sub2,"History");
strcpy(sub3,"Geography");
strcpy(sub4,"Economics");
strcpy(sub5,"Political Science");
}
inputmarks();
}
void displaydata()
{
cout<<"Admission Number : "< cout<<"Name : "< cout<<"Class : "< cout<<"Section:"< cout<<"Sex : "< cout<<"Date of birth : ";
dob.outdate();
cout<<"Father's name : "< cout<<"Mother's name : "< cout<<"Address : "< cout<<"Pincode : "< cout< cout< cout< cout< cout< cout<<"Total Marks : "< cout<<"Average Marks : "< cout<<"Division : "< }
void displaydata2()
{
cout<<"Admission Number : "< cout<<"Name : "< cout<<"Class : "< cout<<"Section:"< cout<<"Sex : "< cout<<"Date of birth : ";
dob.outdate();
cout<<"Father's name : "< cout<<"Mother's name : "< cout<<"Address : "< cout<<"Pincode : "< }
void displaydata3()
{
cout<<"Admission Number : "< cout<<"Name : "< cout<<"Class : "< cout<<"Section:"< cout<<"Sex : "< cout<<"Father's name : "< cout<<"Mother's name : "< cout< cout< cout< cout< cout< cout<<"Total Marks : "< cout<<"Average Marks : "< cout<<"Division : "< }
void displaydata3(int sno)
{
printf("%2i %-20s %2i%c %3i %3i %3i %3i %3i %3i\n",
sno, name[20], clas, sec, marks1, marks2, marks3, marks4, marks5, total);
}
int retadmno() { return admno; }
int rettotal() { return total; }
char* retname() { return name; }
};

int getlastadmno()
{
student a;
int admno;
int len=sizeof(student);
ifstream fin("student.dat",ios::binary);
if (fin==NULL)
admno=0;
else
{
fin.seekg(0,ios::end);
int n=fin.tellg()/len;
if (n==0)
admno=0;
else
{
fin.seekg(len*(n-1),ios::beg);
fin.read((char*)&a,sizeof(a));
admno=a.retadmno();
}
}
fin.close();
return admno;
}

void addrecord()
{
student a;
int lastadmno=getlastadmno();
ofstream fout("student.dat",ios::binary|ios::app);
a.inputdata(lastadmno+1);
clrscr();
a.displaydata();
fout.write((char*)&a, sizeof(a));
fout.close();
cout<<"Student record added to the file ...";
getch();
}

void displayall()
{
student a;
ifstream fin("student.dat",ios::binary);
while (fin.read((char*)&a, sizeof(a)))
{
clrscr();
a.displaydata();
cout< cout<<"Strike any key to see the next record ...";
getch();
}
fin.close();
}

void displaystudent()
{
student a;
ifstream fin("student.dat",ios::binary);
while (fin.read((char*)&a, sizeof(a)))
{
clrscr();
a.displaydata2();
cout< cout<<"Strike any key to see the next record ...";
getch();
}
fin.close();
}

void displaymarks()
{
student a;
ifstream fin("student.dat",ios::binary);
while (fin.read((char*)&a, sizeof(a)))
{
clrscr();
a.displaydata3();
cout< cout<<"Strike any key to see the next record ...";
getch();
}
fin.close();
}

void modifymarks()
{
int admno;
cout<<"Enter admission number to be modified : ";
cin>>admno;
student a;
int found=0;
fstream f("student.dat",ios::binary|ios::in|ios::out);
while(f.read((char*)&a,sizeof(a)))
if(a.retadmno()==admno)
{
a.displaydata3();
a.inputmarks();
f.seekp(-sizeof(a),ios::cur);
f.write((char*)&a,sizeof(a));
found=1;
break;
}
if(found==1)
cout<<"Record updated in the file\n\n";
else
cout<<"Record not found in the file\n\n";
f.close();
cout<<"\n\n\nStrike any key to return ...";
getch();
}

void modifyaddress()
{
int admno;
cout<<"Enter admission number to be modified : ";
cin>>admno;
student a;
int found=0;
fstream f("student.dat",ios::binary|ios::in|ios::out);
while(f.read((char*)&a,sizeof(a)))
if(a.retadmno()==admno)
{
a.displaydata2();
a.inputaddress();
f.seekp(-sizeof(a),ios::cur);
f.write((char*)&a,sizeof(a));
found=1;
break;
}
if(found==1)
cout<<"Record updated in the file\n\n";
else
cout<<"Record not found in the file\n\n";
f.close();
cout<<"\n\n\nStrike any key to return ...";
getch();
}

void deletebyadmno()
{
student a;
ifstream fin("student.dat",ios::binary);
ofstream fout("temp.dat",ios::binary);
int admno,found=0;
clrscr();
cout<<"Enter admission number to be deleted : ";
cin>>admno;
while(fin.read((char*)&a,sizeof(a)))
if(a.retadmno()==admno)
{
a.displaydata();
found=1;
cout< cout<<"Strike any key to delete the record ...";
getch();
}
else
fout.write((char*)&a,sizeof(a));
if(found==1)
cout<<"Record deleted from file\n\n";
else
cout<<"Record not found in the file\n\n";
fin.close();
fout.close();
remove("student.dat");
rename("temp.dat","student.dat");
cout<<"\n\n\nStrike any key to return ...";
getch();
}

void deletebyname()
{
student a;
ifstream fin("student.dat",ios::binary);
ofstream fout("temp.dat",ios::binary);
char name[25];
cout<<"Enter name to search in the file : ";
gets(name);
strupr(name);
int found=0;
while(fin.read((char*)&a,sizeof(a)))
if(strcmp(name, a.retname())==0)
{
a.displaydata();
found=1;
cout< cout<<"Strike any key to delete the record ...";
getch();
}
else
fout.write((char*)&a,sizeof(a));
if(found==1)
cout<<"Record deleted from file\n\n";
else
cout<<"Record not found in the file\n\n";
fin.close();
fout.close();
remove("student.dat");
rename("temp.dat","student.dat");
cout<<"\n\n\nStrike any key to return ...";
getch();
}

void searchbyadmno()
{
int admno;
cout<<"Enter admission number to search in the file : ";
cin>>admno;
int found=0;
student a;
ifstream fin("student.dat",ios::binary);
while(fin.read((char*)&a,sizeof(a)))
if(admno==a.retadmno())
{
found =1;
a.displaydata();
}
fin.close();
if(found==0)
cout<<"Record not found.\n\n";
cout<<"\n\n\nStrike any key to return ...";
getch();
}

void searchbyname()
{
char name[25];
cout<<"Enter name to search in the file : ";
gets(name);
strupr(name);
int found=0;
student a;
ifstream fin("student.dat",ios::binary);
while(fin.read((char*)&a,sizeof(a)))
if(strcmp(name, a.retname())==0)
{
found =1;
a.displaydata();
}
fin.close();
if(found==0)
cout<<"Record not found.\n\n";
getch();
}

void sortonadmno()
{
fstream f("student.dat",ios::binary);
f.seekg(0,ios::end);
int size=sizeof(student);
int n=f.tellg()/size;
student* arr=new student[n];
f.seekg(0);
for (int i=0; i f.read((char*)&arr[i],sizeof (student));
f.close();
for(int k=1;k for(int x=0;x if (arr[x].retadmno()>arr[x+1].retadmno())
{
student t=arr[x];
arr[x]=arr[x+1];
arr[x+1]=t;
}
for (int k=0; k arr[k].displaydata3(k+1);
delete []arr;
cout<<"\n\n\nStrike any key to return ...";
getch();
}

void sortonname()
{
fstream f("student.dat",ios::binary);
f.seekg(0,ios::end);
int size=sizeof(student);
int n=f.tellg()/size;
student* arr=new student[n];
f.seekg(0);
for (int i=0; i f.read((char*)&arr[i],sizeof (student));
f.close();
for(int k=1;k for(int x=0;x if (strcmp(arr[x].retname(),arr[x+1].retname())>0)
{
student t=arr[x];
arr[x]=arr[x+1];
arr[x+1]=t;
}
for (int k=0; k arr[k].displaydata3(k+1);
delete []arr;
cout<<"\n\n\nStrike any key to return ...";
getch();
}

void sortontotal()
{
fstream f("student.dat",ios::binary);
f.seekg(0,ios::end);
int size=sizeof(student);
int n=f.tellg()/size;
student* arr=new student[n];
f.seekg(0);
for (int i=0; i f.read((char*)&arr[i],sizeof (student));
f.close();
for(int k=1;k for(int x=0;x if (arr[x].rettotal() {
student t=arr[x];
arr[x]=arr[x+1];
arr[x+1]=t;
}
for (int k=0; k arr[k].displaydata3(k+1);
delete []arr;
cout<<"\n\n\nStrike any key to return ...";
getch();
}

void main()
{
int ch, ch2;
do
{
clrscr();
cout<<"1. Add Record\n";
cout<<"2. Display Record\n";
cout<<"3. Modify Record\n";
cout<<"4. Search Record\n";
cout<<"5. Delete record\n";
cout<<"6. Sort Record\n";
cout<<"0. Quit\n";
cout<<"Input choice[0-6]? ";
cin>>ch;
switch (ch)
{
case 1: addrecord(); break;
case 2:
clrscr();
cout<<"1. Display All Details\n";
cout<<"2. Display Details w/o Marks\n";
cout<<"3. Display Marks\n";
cout<<"0. Return to Main Menu\n";
cout<<"Input choice[0-3]? ";
cin>>ch2;
switch (ch2)
{
case 1:
displayall();
break;
case 2: displaystudent(); break;
case 3: displaymarks(); break;
}
break;
case 3:
clrscr();
cout<<"1. Modify Address\n";
cout<<"2. Modify Marks\n";
cout<<"0. Return to Main Menu\n";
cout<<"Input choice[0-3]? ";
cin>>ch2;
switch (ch2)
{
case 1: modifyaddress(); break;
case 2: modifymarks(); break;
}
break;
case 4:
clrscr();
cout<<"1. Search by Admission Number\n";
cout<<"2. Search by Name\n";
cout<<"0. Return to Main Menu\n";
cout<<"Input choice[0-3]? ";
cin>>ch2;
switch (ch2)
{
case 1: searchbyadmno(); break;
case 2: searchbyname(); break;
}
break;
case 5:
clrscr();
cout<<"1. Delete by Admission Number\n";
cout<<"2. Delete by Name\n";
cout<<"0. Return to Main Menu\n";
cout<<"Input choice[0-3]? ";
cin>>ch2;
switch (ch2)
{
case 1: deletebyadmno(); break;
case 2: deletebyname(); break;
}
break;
case 6:
clrscr();
cout<<"1. Sort on Admission Number\n";
cout<<"2. Sort on Name\n";
cout<<"3. Sort on Total\n";
cout<<"0. Return to Main Menu\n";
cout<<"Input choice[0-3]? ";
cin>>ch2;
switch (ch2)
{
case 1: sortonadmno(); break;
case 2: sortonname(); break;
case 3: sortontotal(); break;
}
break;
}
}
while (ch!=0);
}

SAMPLE OUTPUT

1. Add Record
2. Display Record
3. Modify Record
4. Search Record
5. Delete record
6. Sort Record
0. Quit
Input choice[0-6]?

Enter student name : ABDUL
Enter class [11/12] : 12
Enter section [A-D] : C
Enter sex [M/F] : M
Enter date of birth : Enter Day [1-31] ? 13
Enter Month [1-12] ? 8
Enter Year [>=1980]? 2001
Enter father name : VINOD
Enter mother name : TINA
Enter address : 180,RAJNATH NAGAR,NEW DELHI
Enter pincode number : 110010
1. Science with Economics
2. Science with Computer Science
3. Science with Biology
4. Commerce with Mathematics
5. Commerce without Mathematics
6. Humanities (Arts)
Enter Stream Code : 2
Enter marks in English : 88
Enter marks in Mathematics : 89
Enter marks in Physics : 66
Enter marks in Chemistry : 65
Enter marks in Computer Science : 61


Admission Number : 1
Name : ABDUL
Class : 12C
Section:C
Sex : M
Date of birth : 13-08-2001
Father's name : VINOD
Mother's name : TINA
Address : 180,RAJNATH NAGAR,NEW DELHI
Pincode : 110010
English : 88
Mathematics : 89
Physics : 66
Chemistry : 65
Economics : 61
Total Marks : 369
Average Marks : 73.8
Division : FIRST
Student record added to the file ...




1. Add Record
2. Display Record
3. Modify Record
4. Search Record
5. Delete record
6. Sort Record
0. Quit
Input choice[0-6]? 2

1. Display All Details
2. Display Details w/o Marks
3. Display Marks
0. Return to Main Menu
Input choice[0-3]?1

Admission Number : 1
Name : ABDUL
Class : 12C
Section:C
Sex : M
Date of birth : 13-08-2001
Father's name : VINOD
Mother's name : TINA
Address : 180,RAJNATH NAGAR,NEW DELHI
Pincode : 110010
English : 88
Mathematics : 89
Physics : 66
Chemistry : 65
Economics : 61
Total Marks : 369
Average Marks : 73.8
Division : FIRST



Strike any key to see the next record ...


Admission Number : 2
Name : GAURI
Class : 11B
Section:B
Sex : F
Date of birth : 17-03-2002
Father's name : MUKESH
Mother's name : LEENA
Address : 12 MG ROAD, CHENNAI
Pincode : 600001
English : 80
Mathematics : 77
Physics : 56
Chemistry : 61
Computer Science : 60
Total Marks : 334
Average Marks : 66.8
Division : FIRST



Strike any key to see the next record ...

Admission Number : 3
Name : JOEY
Class : 12A
Section:A
Sex : M
Date of birth : 07-11-2001
Father's name : TRIBBIANI
Mother's name : CAROL
Address : 6, NEHRU STREET, PUNE
Pincode : 411008
English : 84
Mathematics : 89
Economics : 65
Accountancy : 67
Business Studies : 54
Total Marks : 359
Average Marks : 71.8
Division : FIRST



Strike any key to see the next record ...

Admission Number : 4
Name : ROSS
Class : 12C
Section:C
Sex : M
Date of birth : 05-05-2000
Father's name : JACK
Mother's name : JUDY
Address : FLAT 7, ABC COLONY,SURAT
Pincode : 201008
English : 89
Mathematics : 70
Physics : 56
Chemistry : 55
Computer Science : 60
Total Marks : 330
Average Marks : 66
Division : FIRST



Strike any key to see the next record ...

Admission Number : 5
Name : RACHEAL
Class : 11A
Section:A
Sex : F
Date of birth : 04-11-2002
Father's name : JAMES
Mother's name : SUSAN
Address : 21,PASCHIM VIHAR, NEW DELHI
Pincode : 110063
English : 88
Mathematics : 89
Physics : 61
Chemistry : 60
Economics : 69
Total Marks : 367
Average Marks : 73.4
Division : FIRST



Strike any key to see the next record ...



1. Display All Details
2. Display Details w/o Marks
3. Display Marks
0. Return to Main Menu
Input choice[0-3]? 2

Admission Number : 1
Name : ABDUL
Class : 12C
Section:C
Sex : M
Date of birth : 13-08-2001
Father's name : VINOD
Mother's name : TINA
Address : 180,RAJNATH NAGAR,NEW DELHI
Pincode : 110010



Strike any key to see the next record ...

Admission Number : 2
Name : GAURI
Class : 11B
Section:B
Sex : F
Date of birth : 17-03-2002
Father's name : MUKESH
Mother's name : LEENA
Address : 12 MG ROAD, CHENNAI
Pincode : 600001



Strike any key to see the next record ...

Admission Number : 3
Name : JOEY
Class : 12A
Section:A
Sex : M
Date of birth : 07-11-2001
Father's name : TRIBBIANI
Mother's name : CAROL
Address : 6, NEHRU STREET, PUNE
Pincode : 411008



Strike any key to see the next record ...

Admission Number : 4
Name : ROSS
Class : 12C
Section:C
Sex : M
Date of birth : 05-05-2000
Father's name : JACK
Mother's name : JUDY
Address : FLAT 7, ABC COLONY,SURAT
Pincode : 201008



Strike any key to see the next record ...

Admission Number : 5
Name : RACHEAL
Class : 11A
Section:A
Sex : F
Date of birth : 04-11-2002
Father's name : JAMES
Mother's name : SUSAN
Address : 21,PASCHIM VIHAR, NEW DELHI
Pincode : 110063



Strike any key to see the next record ...

1. Display All Details
2. Display Details w/o Marks
3. Display Marks
0. Return to Main Menu
Input choice[0-3]? 3

Admission Number : 1
Name : ABDUL
Class : 12C
Section:C
Sex : M
Father's name : VINOD
Mother's name : TINA
English : 88
Mathematics : 89
Physics : 66
Chemistry : 65
Economics : 61
Total Marks : 369
Average Marks : 73.8
Division : FIRST



Strike any key to see the next record ...

Admission Number : 2
Name : GAURI
Class : 11B
Section:B
Sex : F
Father's name : MUKESH
Mother's name : LEENA
English : 80
Mathematics : 77
Physics : 56
Chemistry : 61
Computer Science : 60
Total Marks : 334
Average Marks : 66.8
Division : FIRST



Strike any key to see the next record ...

Admission Number : 3
Name : JOEY
Class : 12A
Section:A
Sex : M
Father's name : TRIBBIANI
Mother's name : CAROL
English : 84
Mathematics : 89
Economics : 65
Accountancy : 67
Business Studies : 54
Total Marks : 359
Average Marks : 71.8
Division : FIRST



Strike any key to see the next record ...


1. Add Record
2. Display Record
3. Modify Record
4. Search Record
5. Delete record
6. Sort Record
0. Quit
Input choice[0-6]? 3

1. Modify Address
2. Modify Marks
0. Return to Main Menu
Input choice[0-3]? 1

Enter admission number to be modified : 2
Admission Number : 2
Name : GAURI
Class : 11B
Section:B
Sex : F
Date of birth : 17-03-2002
Father's name : MUKESH
Mother's name : LEENA
Address : 10, PUDEPET, NEW TOWN
Pincode : 1
Enter address : 4/5, SARASWATHIPURAM, MYSORE
Enter pincode number : 110088
Record updated in the file


Strike any key to return ...

1. Modify Address
2. Modify Marks
0. Return to Main Menu
Input choice[0-3]? 2

Enter admission number to be modified : 1
Admission Number : 1
Name : ABDUL
Class : 12C
Section:C
Sex : M
Father's name : VINOD
Mother's name : TINA
English : 88
Mathematics : 89
Physics : 66
Chemistry : 65
Economics : 61
Total Marks : 369
Average Marks : 73.8
Division : FIRST
Enter marks in English : 88
Enter marks in Mathematics : 80
Enter marks in Physics : 67
Enter marks in Chemistry : 66
Enter marks in Economics : 76
Record updated in the file




Strike any key to return ...

1. Search by Admission Number
2. Search by Name
0. Return to Main Menu
Input choice[0-3]? 1
Enter admission number to search in the file : 4

1. Search by Admission Number
2. Search by Name
0. Return to Main Menu
Input choice[0-3]? 1
Enter admission number to search in the file : 4
Admission Number : 4
Name : ROSS
Class : 12C
Section:C
Sex : M
Date of birth : 05-05-2000
Father's name : JACK
Mother's name : JUDY
Address : FLAT 7, ABC COLONY,SURAT
Pincode : 201008
English : 89
Mathematics : 70
Physics : 56
Chemistry : 55
Computer Science : 60
Total Marks : 330
Average Marks : 66
Division : FIRST



Strike any key to return ...

1. Search by Admission Number
2. Search by Name
0. Return to Main Menu
Input choice[0-3]? 2
Enter name to search in the file : JOEY
Admission Number : 3
Name : JOEY
Class : 12A
Section:A
Sex : M
Date of birth : 07-11-2001
Father's name : TRIBBIANI
Mother's name : CAROL
Address : 6, NEHRU STREET, PUNE
Pincode : 411008
English : 84
Mathematics : 89
Economics : 65
Accountancy : 67
Business Studies : 54
Total Marks : 359
Average Marks : 71.8
Division : FIRST

1. Delete by Admission Number
2. Delete by Name
0. Return to Main Menu
Input choice[0-3]? 1

Enter admission number to be deleted : 5
Admission Number : 5
Name : RACHEAL
Class : 11A
Section:A
Sex : F
Date of birth : 04-11-2002
Father's name : JAMES
Mother's name : SUSAN
Address : 21,PASCHIM VIHAR, NEW DELHI
Pincode : 110063
English : 88
Mathematics : 89
Physics : 61
Chemistry : 60
Economics : 69
Total Marks : 367
Average Marks : 73.4
Division : FIRST



Strike any key to delete the record ...

Enter admission number to be deleted : 5
Admission Number : 5
Name : RACHEAL
Class : 11A
Section:A
Sex : F
Date of birth : 04-11-2002
Father's name : JAMES
Mother's name : SUSAN
Address : 21,PASCHIM VIHAR, NEW DELHI
Pincode : 110063
English : 88
Mathematics : 89
Physics : 61
Chemistry : 60
Economics : 69
Total Marks : 367
Average Marks : 73.4
Division : FIRST



Strike any key to delete the record ...Record deleted from file




Strike any key to return ...

1. Delete by Admission Number
2. Delete by Name
0. Return to Main Menu
Input choice[0-3]? 2
Enter name to search in the file : GAURI
Admission Number : 2
Name : GAURI
Class : 11B
Section:B
Sex : F
Date of birth : 17-03-2002
Father's name : MUKESH
Mother's name : LEENA
Address : 4/5, SARASWATHIPURAM, MYSORE
Pincode : 110088
English : 80
Mathematics : 77
Physics : 56
Chemistry : 61
Computer Science : 60
Total Marks : 334
Average Marks : 66.8
Division : FIRST



Strike any key to delete the record ...

1. Delete by Admission Number
2. Delete by Name
0. Return to Main Menu
Input choice[0-3]? 2
Enter name to search in the file : GAURI
Admission Number : 2
Name : GAURI
Class : 11B
Section:B
Sex : F
Date of birth : 17-03-2002
Father's name : MUKESH
Mother's name : LEENA
Address : 4/5, SARASWATHIPURAM, MYSORE
Pincode : 110088
English : 80
Mathematics : 77
Physics : 56
Chemistry : 61
Computer Science : 60
Total Marks : 334
Average Marks : 66.8
Division : FIRST



Strike any key to delete the record ...Record deleted from file




Strike any key to return ...


1. Add Record
2. Display Record
3. Modify Record
4. Search Record
5. Delete record
6. Sort Record
0. Quit
Input choice[0-6]? 6

1. Sort on Admission Number
2. Sort on Name
3. Sort on Total
0. Return to Main Menu
Input choice[0-3]? 1



Strike any key to return ...



1. Sort on Admission Number
2. Sort on Name
3. Sort on Total
0. Return to Main Menu
Input choice[0-3]? 2



Strike any key to return ...

1. Sort on Admission Number
2. Sort on Name
3. Sort on Total
0. Return to Main Menu
Input choice[0-3]? 3



Strike any key to return ...


A BREIF DESCRIPTION...

This project is a basic algorithm for ATM machines, and provides three facilities,
  • create an account
  • withdraw cash
  • deposit cash
While creating an account,
  • The credit card numbers are validated using Luhn's algorithm.
  • The credit card number has to be unique, if it has already been created, it wont be accepted
While withdrawing cash,
  • The cash to be withdrawn has to be between 10£ and 200£
  • The amount of cash to be withdrawn has to be a multiple of 10
While depositing cash,
  • The cash to be deposited has to be less than 20000£
  • The amount of cash to be deposited has to be a multiple of 10

CODE:

card=0
newdig=[]
amtcounter=0
acctholder=" "
def inpcard():
global card
card=int(input("enter card? "))

def valcard():
global card
dig=[]
k=0
sumdig=0
card=str(card)
for x in card:
dig.append(int(x))
k+=1
#print (dig)
chk=0
if(k!=16):
print("INVALID CARD NUMBER")
print("TRY AGAIN")
inpcard()
valcard()
chk=1
else:
file=open("card.txt")
for line in file:
line1=line.split()
if(line1[0]==card):
print("CARD ALREADY EXISTS")
print("TRY AGAIN")
chk=1
inpcard()
valcard()
break
file.close()

if chk==0:
for k in range (16):
if k%2==0:
if (2*dig[k])>9:
num=2*dig[k]
dig[k]=num//10+num%10
else:
dig[k]=2*dig[k]
#print(dig)
for k in range (16):
sumdig+=dig[k]
if sumdig%10==0:
file=open("card.txt", 'a')
print("VALID CARD NUMBER")
name=input("card holder name? ")
cash=int(input("cash held by cardholder?"))
rec=card+'\t\t'+name+'\t\t'+str(cash)+'\n'
file.writelines(rec)
file.close()

else:
print("INVALID CARD NUMBER")
print("TRY AGAIN")
inpcard()
valcard()
#for opening account:
def inpamt():
global amt
amt=int(input("enter amount to be withdrawn[10£-200£]? "))
def inpcash():
global amt, card, acctholder
card=int(input("enter card? "))
#acctholder=" "
file=open("card.txt")
f=0
for line in file:
line1=line.split()
#print(line1[0])
#for k in range (16):
#line1+=line1[k]
#print(line1)
if (line1[0]==str(card)):
print( line)
acctholder=line
inpamt()
f=1
break
if f==0:
print (card, " IS NOT FOUND. TRY AGAIN ")
inpcash()
file.close()

def withdrawcash():
global amt, acctholder, card, amtcounter
chk=0
if (amt>=10 and amt<=200)== False:
print("AMOUNT TO WITHDRAW HAS TO BE BETWEEN 10£-200£ ")
print("TRY AGAIN")
inpcash()
withdrawcash()
chk=1
if amt%10 !=0:
print("AMOUNT TO WITHDRAW HAS TO BE MULTIPLE OF 10 ")
print("TRY AGAIN")
inpcash()
withdrawcash()
chk=1
if chk==0:
list1=acctholder.split()
if amt>int(list1[2]):
print("YOU DONT HAVE THAT MUCH MONEY ")
print("TRY AGAIN")
inpcash()
withdrawcash()
else:
amtcounter+=amt
#print(amtcounter)
if (amtcounter>=1000):
print("THIS MACHINE IS OUT OF BANK NOTES. SORRY FOR THE INCONVENIENCE")
else:
listf=[]
file2=open("card.txt")
for line2 in file2:
line2=line2.strip()
list2=line2.split()
if list2[0]==str(card): #try acctholder==line
list2[2]=str(int(list2[2])-amt)
print (amt, " £ has been withdrawn from your acct. Your balance is:" , list2[2])
if (amt%20==0):
print("you will recieve ", amt//20 , " 20 £ notes ")
else:
print("you will recieve ", amt//20 , " 20 £ notes and 1 10 £ note")
rec=list2[0]+'\t\t'+list2[1]+'\t\t'+list2[2]+'\n'
listf.append(rec)
file2.close()
file3=open("card.txt", 'w')
file3.writelines(listf)
file3.close()

def inpamt1():
global amt
amt=int(input("enter amount to be deposited? "))
def inpcash1():
global amt, card, acctholder
card=int(input("enter card? "))
#acctholder=" "
file=open("card.txt")
f=0
for line in file:
line1=line.split()
#print(line1[0])
#for k in range (16):
#line1+=line1[k]
#print(line1)
if (line1[0]==str(card)):
print( line)
acctholder=line
inpamt1()
f=1
break
if f==0:
print (card, " IS NOT FOUND. TRY AGAIN ")
inpcash1()
file.close()
def depositcash():
global amt, acctholder, card, amtcounter
chk=0
if (amt<=20000)== False:
print("AMOUNT TO DEPOSIT HAS TO BE LESS THAN 20000£ ")
print("TRY AGAIN")
inpcash1()
depositcash()
chk=1
if amt%10 !=0:
print("AMOUNT TO DEPOSIT HAS TO BE MULTIPLE OF 10 ")
print("TRY AGAIN")
inpcash1()
depositcash()
chk=1
if chk==0:
listf=[]
file2=open("card.txt")
for line2 in file2:
line2=line2.strip()
list2=line2.split()
if list2[0]==str(card):
list2[2]=str(int(list2[2])+amt)
print (amt, " £ has been deposited into your acct. You now possess" , list2[2], "euros")
rec=list2[0]+'\t\t'+list2[1]+'\t\t'+list2[2]+'\n'
listf.append(rec)
file2.close()
file3=open("card.txt", 'w')
file3.writelines(listf)
file3.close()

#MAIN FUNCTION:

def main():
print("1. CREATE AN ACCOUNT ")
print("2. WITHDRAW CASH ")
print("3. DEPOSIT CASH ")
print("0. EXIT ")
ch=int(input("ENTER CHOICE[0-3]: "))
if ch==1:
inpcard()
valcard()
main()
elif ch==2:
inpcash()
withdrawcash()
main()
elif ch==3:
inpcash1()
depositcash()
main()
elif ch==0:
print("YOU HAVE EXITTED ")
else:
print("YOUR CHOICES ARE LIMITED TO [0-2]. TRY AGAIN. ")
main()
main()

CONTENTS IN card.txt

4587783636151130         John         100000
8504172191273888         Jack         800200
5100840250474175         Jill           0
5178499998141062         Joan         9999910
6011579033390466         Noah        908010
6011754088497223         Mira         899830

SAMPLE OUTPUT

1. CREATE AN ACCOUNT
2. WITHDRAW CASH
3. DEPOSIT CASH
0. EXIT
ENTER CHOICE[0-3]: 1

enter card number? 23434554
INVALID CARD NUMBER
TRY AGAIN
enter card number? 6011754088497223
CARD ALREADY EXISTS
TRY AGAIN
enter card number? 342099279872187
INVALID CARD NUMBER
TRY AGAIN
enter card number? 4485638651407424
VALID CARD NUMBER
card holder name? ANIKA
cash held by cardholder?40000

1. CREATE AN ACCOUNT
2. WITHDRAW CASH
3. DEPOSIT CASH
0. EXIT
ENTER CHOICE[0-3]: 2

enter card? 4485638651407424
4485638651407424        ANIKA        40000
enter amount to be withdrawn[10£-200£]? 1
AMOUNT TO WITHDRAW HAS TO BE BETWEEN 10£-200£
TRY AGAIN
enter card? 4485638651407424
4485638651407424        ANIKA        40000
enter amount to be withdrawn[10£-200£]? 25
AMOUNT TO WITHDRAW HAS TO BE MULTIPLE OF 10
TRY AGAIN
enter card? 4485638651407424
4485638651407424        ANIKA        40000
enter amount to be withdrawn[10£-200£]? 100
100 £ has been withdrawn from your acct. Your balance is: 39900
you will recieve 5 20 £ notes

1. CREATE AN ACCOUNT
2. WITHDRAW CASH
3. DEPOSIT CASH
0. EXIT
ENTER CHOICE[0-3]: 3
enter card? 4485638651407424
4485638651407424        ANIKA        39900
enter amount to be deposited? 5000000
AMOUNT TO DEPOSIT HAS TO BE LESS THAN 20000£
TRY AGAIN
enter card? 4485638651407424
4485638651407424        ANIKA        39900
enter amount to be deposited? 32
AMOUNT TO DEPOSIT HAS TO BE MULTIPLE OF 10
TRY AGAIN
enter card? 4485638651407424
4485638651407424        ANIKA        39900
enter amount to be deposited? 100
100 £ has been deposited into your acct. You now possess 40000 euros

1. CREATE AN ACCOUNT
2. WITHDRAW CASH
3. DEPOSIT CASH
0. EXIT
ENTER CHOICE[0-3]:

Creating this website might be the most engaging project I have ever undertaken.
I designed it using HTML, CSS and a bit of JavaScript, all of which I learnt from the internet.

This was my first experiment with HTML, and at that time, I had also just begun applying for my visa. So I decided to try and replicate the Visa application form. However, it is a very rudimentary project. Click here to view the project.