-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompte.cpp
More file actions
47 lines (39 loc) · 691 Bytes
/
Compte.cpp
File metadata and controls
47 lines (39 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <string>
using namespace std;
#include "Compte.h"
#include <exception>
#include <stdexcept>
Compte::Compte(double s)
{
if(s>=0){
solde=s;
} else{
solde=0.0;
cout<<"ERROR: le solde initial était invalide"<<endl;
}
}
bool Compte::credit(double m)
{
if (m<0)
return false;
solde+=m;
return true;
}
bool Compte::debit(double n)
{
if(n>solde){
cout<<"Debit amount exceeded account balance"<<endl;
return false;
}else{
solde=solde-n;
return true;
}
}
double Compte::calculateInterest(){
return 0;
}
double Compte::getBalance()
{
return solde;
}