-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoinpile.cpp
More file actions
29 lines (21 loc) · 832 Bytes
/
coinpile.cpp
File metadata and controls
29 lines (21 loc) · 832 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
#include "coinpile.h"
#include "iostream"
#include <math.h>
using namespace std;
CoinPile::CoinPile() = default;
CoinPile::CoinPile(double price):ParentClass(price){}
CoinPile::CoinPile(const CoinPile &coinPile):ParentClass(coinPile.price_){}
double CoinPile::getVolume() const {
int hundreds = int(this->price_)/100;
int fifties = int(this->price_ - hundreds * 100)/ 50;
int tens = int(this->price_ - hundreds * 100 - fifties * 50) / 10;
int fives = int(this->price_ - hundreds * 100 - fifties
* 50 - tens * 10) / 5;
int ones = int(ceil(this->price_ - hundreds * 100 - fifties
* 50 - tens * 10 - fives * 5));
return hundreds + fifties + tens + fives + ones;
}
bool CoinPile::how(){
return false;
}
CoinPile::~CoinPile(){}