Advertisement
amolab

Untitled

Feb 25th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include "tglass.h"
  2.  
  3. TGlass::TGlass(double capacity_cc){
  4.     _capacity=capacity_cc;
  5.     _amount=0.0;
  6. }
  7.  
  8. void TGlass::PourLiquid(double cc){
  9.     _amount=_amount+cc;
  10.     if(_amount>_capacity) _amount=_capacity;
  11. }
  12.  
  13. void TGlass::Drink(double cc){
  14.     _amount=_amount-cc;
  15.     if(_amount<0) _amount=0;
  16. }
  17.  
  18. double TGlass::GetRemaining(){
  19.     return _amount;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement