0
Help pls Tracking your bank account C++
What do I do?
8 Answers
+ 2
Alena Sherine before that, link your bank details so he can track itđȘ
+ 1
Simba i supposed that he is asking about banking system project đ
+ 1
Thank you I appreciate your help! :)
+ 1
//your code goes here
Account operator+(Account &obj){
Account res;
res.balance = this -> balance + obj.balance;
res.interest = this -> interest + obj.interest;
return res;
}
0
Link your code here so we can check better where u stucked
0
#include <iostream>
using namespace std;
class Account {
private:
int balance=0;
int interest=0;
public:
Account() {}
Account(int a): balance(a)
{
interest += balance/10;
}
int getTotal() {
return balance+interest;
}
//your code goes here
Account operator+ (Account&obj){
}
};
int main() {
int n1, n2;
cin >> n1 >> n2;
Account a(n1);
Account b(n2);
Account res = a+b;
cout << res.getTotal();
}
0
#include <iostream>
using namespace std;
class Account {
private:
int balance=0;
int interest=0;
public:
Account() {}
Account(int a): balance(a)
{
interest += balance/10;
}
int getTotal() {
return balance+interest;
}
//your code goes here
Account operator+ (Account&obj){
Account res;
res. getTotal()=this->getTotal()+obj.getTotal();
return res;
}
};
int main() {
int n1, n2;
cin >> n1 >> n2;
Account a(n1);
Account b(n2);
Account res = a+b;
cout << res.getTotal();
}
0
Try this one is it showing correct output according to your inputs
https://code.sololearn.com/ce9FBw06v9hx/?ref=app