00001 /* 00002 State_Tax.hpp 00003 00004 Object Definition and Implementation for State_Tax. 00005 00006 These classes are built by w3sys RAD tools 00007 to be compatible with STL, and to be derivable 00008 00009 Copyright(c)2006 - D.K. McCombs. 00010 W3 Systems Design - davidmc@w3sys.com 00011 http://www.w3sys.com 00012 00013 */ 00014 #ifndef State_Tax_HPP 00015 #define State_Tax_HPP 00016 00017 #include "ocTypes.h" 00018 00019 00020 00021 class State_Tax 00022 { 00023 double m_PercentTax; 00024 00025 protected: 00026 // data members 00027 string m_State; 00028 money m_ProductTotal; 00029 money m_TaxTotal; 00030 00031 public: 00032 // constructor 00033 State_Tax():m_PercentTax(0.0), 00034 m_State(""), 00035 m_ProductTotal(0.0), 00036 m_TaxTotal(0.0) 00037 { 00038 ; 00039 } 00040 // destructor 00041 virtual ~State_Tax(){;} 00042 // copy constructor 00043 State_Tax( const State_Tax & in): 00044 m_State(in.m_State), 00045 m_ProductTotal(in.m_ProductTotal), 00046 m_TaxTotal(in.m_TaxTotal) 00047 { 00048 ; 00049 } 00050 // assignment operator 00051 State_Tax & operator = ( const State_Tax & in ) 00052 { 00053 m_State = in.m_State; 00054 m_ProductTotal = in.m_ProductTotal; 00055 m_TaxTotal = in.m_TaxTotal; 00056 return *this; 00057 } 00058 // member access operators 00059 // get 00060 string & State( void ) { return m_State; } 00061 // set 00062 void State( const string & in ) 00063 { 00064 m_State = in; 00065 // specialized for logomats: nexus in Cobb county GA, sales tax = 6% 00066 if( m_State == "GA" ) 00067 { 00068 m_PercentTax = 0.06; 00069 } 00070 // need other counties/ states for kleentex 00071 } 00072 00073 // get 00074 money & ProductTotal( void ) { return m_ProductTotal; } 00075 // set 00076 void ProductTotal( const money & in ) { m_ProductTotal = in; } 00077 00078 // get 00079 money & TaxTotal( void ) 00080 { 00081 m_TaxTotal.amount() = m_ProductTotal.amount() * m_PercentTax; 00082 return m_TaxTotal; 00083 } 00084 00085 00086 00087 00088 }; 00089 #endif
1.5.5