1 /**************************************************************************
2 ** (c) Copyright 1999, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
6 ** FILE NAME : amount.cpp
7 ** SYSTEM NAME : Andromeda X-Windows Encapsulation
8 ** VERSION NUMBER : $Revision: 1.2 $
10 ** DESCRIPTION : Financial classes : amount
12 ** EXPORTED OBJECTS : class amount
15 ***************************************************************************
16 ** ADMINISTRATIVE INFORMATION *
17 ********************************
18 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
19 ** CREATION DATE : Aug 26, 1999
20 ** LAST UPDATE : Aug 26, 1999
22 **************************************************************************/
24 /*****************************
26 Revision 1.2 2002-11-04 07:24:31 arjen
27 Use proper namespace for iostream classes
29 Revision 1.1 2002/07/25 08:01:26 arjen
30 First checkin, AXE release 0.2
32 *****************************/
34 static const char RCSID[] = "$Id: amount.cpp,v 1.2 2002-11-04 07:24:31 arjen Exp $";
38 std::istream &operator>>(std::istream &s, amount &a)
43 s >> hundreds >> c >> a.value;
44 a.value += hundreds * 100;
49 std::ostream &operator<<(std::ostream &s, amount a)
64 //s << form("%8d.%02d",a / 100, a % 100);
70 amount::amount(String s)
72 int dp; // The position of the decimal point
87 value += (unsigned long)s;
91 // No decimal point; integer value
98 amount::operator String()
102 s = String(value / 100) + "." + String(value % 100);
107 String amount::make_string(void)
112 s = String(value / 100) + ".";
113 decimals = String(value % 100);
116 decimals = "0" + decimals;