Skip to content

Instantly share code, notes, and snippets.

@arunenigma
Created March 10, 2013 15:57
Show Gist options
  • Select an option

  • Save arunenigma/5129112 to your computer and use it in GitHub Desktop.

Select an option

Save arunenigma/5129112 to your computer and use it in GitHub Desktop.
cashregister.cpp
//
// cashregister.cpp
// cppbin
//
// Created by Arunprasath Shankar on 3/10/13.
// Copyright (c) 2013 Arunprasath Shankar. All rights reserved.
//
#include "cashregister.h"
CashRegister::CashRegister()
{
clear();
}
void CashRegister::clear() {
item_count = 0;
total_price = 0;
}
void CashRegister::add_item(double price) {
item_count ++;
total_price = total_price + price;
}
double CashRegister::get_total() const {
return total_price;
}
int CashRegister::get_count() const {
return item_count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment