76 964
Assignments Done
Successfully Done
In June 2019

Answer to Question #22564 in C# for vathsalya

Question #22564
4. Create a class Account with two overloaded constructors. The first constructor is used for initializing the name of account holder, the account number and the initial amount in the account. The second constructor is used for initializing the name of account holder, account number, address, the type of account and the current balance. The Account class is having methods Deposit(), Withdraw() and GetBalance(). Make necessary assumptions for data members and return types of methods. Create objects of Account class and use them.
Expert's answer
#include <iostream>
#include <string>
using namespace std;
class Account{
string accountHolder;
int accountNumber;
int initialAmount;
string typeOfAccount;
string address;
int currentBalance;
Account(string name, int num, int init){
accountHolder = name;
accountNumber = num;
initialAmount = init;
Account(string name, int num, string type, string _address, int current){
accountHolder = name;
accountNumber = num;
typeOfAccount = type;
address = _address;
currentBalance = current;
void Deposit(int d){
if (typeOfAccount == "deposit")
else cout<<"Error, your account don't supports this type of opperation\nYou need to create 'deposit' account\n";

int withDraw(int sum){
if (currentBalance >= sum){
return sum;
}else cout<<"Your account don't have this amount of money\n";
int GetBalance(){
return currentBalance;

int main(){
Account acc("Anton",123,"deposit","sechenova6",1000);


cout<<"Your balance "<<acc.GetBalance()<<endl;

return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions