Hello! This is C++. Create a Class Account that manage the transactions, the wit
ID: 3706951 • Letter: H
Question
Hello! This is C++.
Create a Class Account that manage the transactions, the withdraw and making deposit operations.
The class should include a constructor, a setter to set the interest rate, a method to make deposit, a method to calculate the interest, a method to check if possible to withdraw and the getters.
There should be a seperation between the specification (Account.h) and implementation ( Account.cpp)
Could you please be kind enough and type the code for copying and show me the screenshot can be shown your work?
Thank you so much for reading this and have a good one!
Explanation / Answer
Following is the C++ Program:
#include <iostream>
#include <conio.h>
#include <stdlib.h>
unsigned long amount=1000, deposit, withdraw;
int choice, pin, k;
char transaction ='y';
int main()
{
do
{
cout<<"********Welcome************** ";
cout<<"1. Check Balance ";
cout<<"2. Withdraw Cash ";
cout<<"3. Deposit Cash ";
cout<<"4. Quit ";
cout<<"******************* ";
cout<<"Enter your choice: ";
cin>>choice;
switch (choice)
{
case 1:
cout<<" YOUR BALANCE IN Rs : %lu " << amount;
break;
case 2:
cout<<" ENTER THE AMOUNT TO WITHDRAW: ";
cin>> withdraw;
if (withdraw % 100 != 0)
{
cout<<" PLEASE ENTER THE AMOUNT IN MULTIPLES OF 100 ";
}
else if (withdraw >(amount - 500))
{
cout<<" INSUFFICENT BALANCE ";
}
else
{
amount = amount - withdraw;
cout<<" PLEASE COLLECT CASH ";
cout<<" YOUR CURRENT BALANCE IS%lu "<< amount;
}
break;
case 3:
cout<<" ENTER THE AMOUNT TO DEPOSIT ";
cin>>deposit;
amount = amount + deposit;
cout<<"YOUR BALANCE IS %lu "<< amount;
break;
case 4:
cout<<" THANK U USING ATM ";
break;
default:
cout<<" INVALID CHOICE";
}
cout<<" DO U WISH TO HAVE ANOTHER TRANSCATION?(y/n): ";
fflush(stdin);
scanf("%c", &transaction);
if (transaction == 'n'|| transaction == 'N')
k = 1;
} while (!k);
cout<<" THANKS FOR USING OUT ATM SERVICE";
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.