about-text

SoftOSet is the most remarkable programming site. SoftOSet provides the fresh conceptual and professional programs, articles, books, and other interesting and technical writings. SoftOSet is the most reliable programming site to learn the programs and the basics of the popular programming languages. SoftOSet is the hub of the informative and research based articles.

To Find the Bank Credit Exceed or not Program in C++

This C++ program will take the user bank account number, his beginning balance, total charges and the current charges and then display the user credit limit is exceeds or it is all right.


Question to be addressed

Develop a C++ program that will determine whether a department-store

customer has exceeded the credit limit on a charge account. For each customer, the following facts

are available:

a) Account number (an integer)

b) Balance at the beginning of the month

c) Total of all items charged by this customer this month

d) Total of all credits applied to this customer's account this month

e) Allowed credit limit

The program should use a while statement to input each of these facts, calculate the new balance

(= beginning balance + charges – credits) and determine whether the new balance exceeds the customer’s

credit limit. For those customers whose credit limit is exceeded, the program should display

the customer’s account number, credit limit, new balance and the message “Credit Limit Exceeded.”

Program to Find the exceed credit limit

One thing to be noted that these programs are compiled and tested on the Dev C++  IDE. So if you want the same output from them download and install the Dev C++ from here and then run the code.

Code

#include<iostream>

using namespace std;

int main()

{

            int bb,cl,nb,charges,ac,tc;

            while(ac!=-1)

            {

                        cout<<"Enter Acccount number or(-1 to Exit) \t=";

                        cin>>ac;

                        cout<<"\n\n\t";

                        if(ac==-1)

                        continue;

                        cout<<"Enter the Begning Balance\t=";

                        cin>>bb;

                        cout<<"\n\n\t";

                        cout<<"Enter the Total Charges\t=";

                        cin>>tc;

                        cout<<"\n\n\t";

                                                cout<<"Enter the Charges\t=";

                        cin>>charges;

                        cout<<"\n\n\t";

                                                cout<<"Enter the Credit Limit\t=";

                        cin>>cl;

                        cout<<"\n\n\t";

                        nb=bb+charges;

                        cout<<"New Balance\t\t="<<nb<<endl;

                        cout<<" Acccount number  \t\t="<<ac<<endl;

                        cout<<"Credit Limit  \t\t="<<cl<<endl;

        cout<<"Balance \t\t="<<nb<<endl;

        if(nb>cl)

        cout<<"Credit Limit is Exceeds\n";

        else

        cout<<"Credit is all right";

    

            }

            return 0;

}

Output

And here is the sample output of this code. If you have any error about the code then contact us. We will surely help you to run your code and resolve your error.

 

 

 

 

 

Explanation

What I have do in this code is just simply that, I have included the header file of the <iostream>. If you are using any other compiler instead of Dev C++, then you must have to add some other headers according to the requirement of your compiler. The next statement is using namespace std;. It is just used in the Dev C++, if you or using any other compiler then you probably no need to add this statement.

 

main()

In main function we have just take some values from the user and provide him is her credit limit is exceeds or not. We have taken the beginning balance of user and charges and calculate the new balance from it. Then we have taken the credit limit of user account from the user and compare it with the new balance. If new balance is greater than the entered credit limit then credit limit is exceed else it is all right.

And then we have transferred the control back to the system using the

return 0;

statement.

Conclusion

Now I conclude the whole story in a single sentence

“Problem solving is the core feature of c++.”

If you have any type of bug or error in your code feel free to take guidance from us. Our team will try its best to help you to remove your bug.

 

Thank you

 

 


Post a Comment

Feel Free to Comment Us

Previous Post Next Post

Recents