Add Initial commit for print and remove functions

This commit is contained in:
Lev
2021-06-12 19:27:37 -05:00
parent 28e8407e6b
commit d09c87819a
13 changed files with 4295 additions and 0 deletions

View File

@ -0,0 +1,40 @@
#include "Wallet.h"
Wallet::Wallet()
{
}
void Wallet::insertCurrency(std::string type, double amount)
{
double balance;
if(amount < 0)
{
throw std::exception{};
}
if(currencies.count(type) == 0) // not in wallet yet
{
balance = 0;
}
else
{
balance = currencies[type];
}
balance += amount;
currencies[type] = balance;
}
bool Wallet::containsCurrency(std::string type, double amount)
{
if(currencies.count(type) == 0) // not in wallet yet
{
return false;
}
else
return currencies[type] >= amount;
}
std::string Wallet::toString()
{
return "Oink!";
}