/* 잘 모르겠어서 복붙해온 참고용 p.151-3
#include <iostream>
#include <string>
using namespace std;
class Account{
private:
string name;
int id;
int money;
public:
Account(string s, int a, int b);
void deposit(int a);
string getOwner();
int withdraw(int a);
int inquiry();
};
Account::Account(string s, int a, int b){
name = s;
id = a;
money = b;
}
void Account::deposit(int a){
money += a;
}
string Account::getOwner(){
return name;
}
int Account::withdraw(int a){
money -= a;
return a;
}
int Account::inquiry(){
return money;
}
int main(){
Account a("Kitae", 1, 5000);
a.deposit(50000);
cout << a.getOwner() << "의 잔액은 " << a.inquiry() << endl;
int money = a.withdraw(20000);
cout << a.getOwner() << "의 잔액은 " << a.inquiry() << endl;
}
*/
/* c++ 과제 p.151-4
#include <iostream>
using namespace std;
class CoffeeMachine
{
private:
int CoffeeAmount; // 커피량
int WaterAmount; // 물량
int sugar; // 설탕
public:
CoffeeMachine(int c, int w, int s);
void drinkEspresso();
void drinkAmericano();
void drinkSugarCoffee();
void fill();
void show();
};
CoffeeMachine::CoffeeMachine(int c, int w, int s)
{
CoffeeAmount=c;
WaterAmount=w;
sugar=s;
}
void CoffeeMachine::drinkEspresso()
{
CoffeeAmount=CoffeeAmount-1;
WaterAmount=WaterAmount-1;
}
void CoffeeMachine::drinkAmericano()
{
CoffeeAmount=CoffeeAmount-1;
WaterAmount=WaterAmount-2;
}
void CoffeeMachine::drinkSugarCoffee()
{
CoffeeAmount=CoffeeAmount-1;
WaterAmount=WaterAmount-2;
sugar=sugar-1;
}
void CoffeeMachine::fill()
{
CoffeeAmount=10;
WaterAmount=10;
sugar=10;
}
void CoffeeMachine::show()
{
cout << "커피 마신 상태, 커피:" << CoffeeAmount << "\t물:" << WaterAmount << "\t설탕:" << sugar << endl;
}
int main()
{
CoffeeMachine java(5, 10, 3);
java.drinkEspresso();
java.show();
java.drinkAmericano();
java.show();
java.drinkSugarCoffee();
java.show();
java.fill();
java.show();
}
*/