C program for bank account, C/C++ Programming

Aim: To implement a program for bank account using static data type.

Code:

class bank

{

            static int acc_no;

            int acc;

            float bal;

            public:

            int open_ac(float b)

            {

                        acc_no++;

                        acc=acc_no;

                        bal=b;

                        return(acc_no);

            }

            void deposit()

            {

                        int am;

                        cout<<"Enter amount: Rs.";

                        cin>>am;

                        bal=bal+am;

                        cout<<"Amount Deposited!\nNew Balance: Rs. "<

            }

            void withdrawl()

            {

                        int am;

                        cout<<"Enter amount: Rs.";

                        cin>>am;

                        if(bal<(am+500))

                                    cout<<"Sorry! transaction can not be processed. Balance not available.";

                        else

                        {

                                    bal=bal-am;

                                    cout<<"Amount withdrawn.";

                                    cout<

                        }

            }

};

int bank :: acc_no=99;

void main()

{

            int c,x=0,b,id;

 

            clrscr();

            bank cust[5];

            cout<<"BANK DATABASE";

            do

            {

                        cout<<"\n1. Create A/c.\n2. Deposit\n3. Withdrawl\n4. Exit";

                        cout<<"\n\nEnter your choice:";

                        cin>>c;

                        switch(c)

                        {

                                    case 1:

                                    cout<

                                    cin>>b;

                                    id=cust[x].open_ac(b);

                                    x++;

                                    cout<<"You a/c is opened! A/c No. "<

                                    break;

 

                                    case 2:

                                    cout<<"Enter A/c No. for deposit:";

                                    cin>>id;

                                    if(id>(x+99))

                                    {

                                                cout<<"Wrong A/c no.";

                                                break;

                                    }

                                    cust[id-100].deposit();

                                    break;

 

                                    case 3:

                                    cout<<"Enter A/c No. for withdrawl:";

                                    cin>>id;

                                    if(id>(x+99))

                                    {

                                                cout<<"Wrong A/c no.";

                                                break;

                                    }

                                    cust[id-100].withdrawl();

                                    break;

 

                                    case 4:

                                    exit(1);

                                    break;

                        }

 

            }while(x<=4);

            getch();

}

 

Output:

BANK DATABASE

1. Create A/c.

2. Deposit

3. Withdrawl

4. Exit

Enter your choice:1

Enter balance:4000

You a/c is opened! A/c No. 100

1. Create A/c.

2. Deposit

3. Withdrawl

4. Exit

 

Enter your choice:2

Enter A/c No. for deposit:100

Enter amount: Rs.800

Amount Deposited!

New Balance: Rs. 4800

1. Create A/c.

2. Deposit

3. Withdrawl

4. Exit

 

Enter your choice:3

Enter A/c No. for withdrawl:100

Enter amount: Rs.900

Amount withdrawn.

Balance: Rs.3900

1. Create A/c.

2. Deposit

3. Withdrawl

4. Exit

Enter your choice:4

Posted Date: 9/29/2012 3:59:02 AM | Location : United States







Related Discussions:- C program for bank account, Assignment Help, Ask Question on C program for bank account, Get Answer, Expert's Help, C program for bank account Discussions

Write discussion on C program for bank account
Your posts are moderated
Related Questions
Prepare data from fixed OCR areas scanned. Project Description: Project is to design software which can use character recognition only on certain areas of scanned pdf's/ jpeg

Problem : Compiler Design - Limit the methods Rahul is a newbie to the programming and while learning the programming language he came to know the following rules: ·

A: It allows a program to reference an identifier in global scope which has been hidden by another identifier along with the same name in the local scope.

describe how identifiers of different data type are defined using this notaion?

Define Enumeration in Computer Programming? Enumerated types enclose a list of constants that are able to be addressed in integer values. We can declare variables and types

program that convert take decimal digit and convert it to binart digit

I have a program for school and I am not understanding why one of the variables gets skipped or the arithmetic operators aren''t having any effect as I have tryed defining it sever

Project Description: 1) Develop banking software 2) Payment Gateway System There is some other system available for development. I'm willing to show long-term opportunity

Write a C# program to compute the Net Pay for employees. The program is to have a Main method and two user-defined methods. The Main method is to input the employee's name (string)

Consider text comprised of sentences and sentences comprised of words. Words in a sentence will be space delimited. Given a text and K strings, task is to find out the number valid