Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Needs to be written in C++ with no use of System pause. ------------------------

ID: 3695758 • Letter: N

Question

Needs to be written in C++ with no use of System pause.

-----------------------------------------------------------------------------------------------------------------

Design a class named Account that contains:

A field named ID (int)

A field named ownerName (string)

A field named interestRate (double) representing the monthly interest rate

A field named balance (double)

Accessor and Mutator functions for ID, ownerName, interestRate and balance fields.

A function named getAnnualInterest( ) that returns the annual interest rate.

A function named withdraw( ) that withdraws a specified amount (given as an argument) from the account. The function verifies that the amount is positive and that there are sufficient funds in the account and issues an error message if these conditions are not met. The function updates the remaining balance accordingly.

A function named deposit( ) that deposits a specified amount (given as an argument) to the account. The function verifies that the amount is positive and issues an error message if it isn’t. The function updates the remaining balance accordingly.

Write a test program that creats an account and assigns its ID to 7497, its balance to 30000 and its monthly interest rate to 0.35%. Use your name as the ownerName.

Make two withdrawals, one of them with no sufficient balance, and two deposits. After each operation, the program should obtain the remaining balance and print the annual interest rate.

Explanation / Answer

class account

{

                int ID;

                char name[20];

                double intrate;

                double balance;

                int getAnnualInterest()

                {

                                Intrate=0.35;

                                Return (intrate);

                public:

                void getdata();

                void deposit(int);;

                void withdrawl(int)

};

Void account :: getdata(){

cin>>ID;

gets(name);

getAnnualInterest();

cin>>balance;

}

void account :: deposite(int x)

{

balance=balance+x;

}

void account:: withdrawl(int y)

{

                if(balance>y)

                balance=balace-x;

                else

                cout<<”Insuficient balance”;

}

void main()

{

                int a,b;

                account st, st2;

                cout<<”Enter the amount to be deposited”;

                cin>>a;

                cout<<”Enter the amount to be withdrawl”;

                cin>>b;

                st.getdata();

                s2.getdata();

                st.deposit();

                st2.deposit();

                st.withdrawl();

                st.withdrawl();

                getch();

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote