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.1 $
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.1 2002-07-25 08:01:26 arjen
27 First checkin, AXE release 0.2
29 *****************************/
31 static const char RCSID[] = "$Id: amount.cpp,v 1.1 2002-07-25 08:01:26 arjen Exp $";
35 istream &operator>>(istream &s, amount &a)
40 s >> hundreds >> c >> a.value;
41 a.value += hundreds * 100;
46 ostream &operator<<(ostream &s, amount a)
61 //s << form("%8d.%02d",a / 100, a % 100);
67 amount::amount(String s)
69 int dp; // The position of the decimal point
84 value += (unsigned long)s;
88 // No decimal point; integer value
95 amount::operator String()
99 s = String(value / 100) + "." + String(value % 100);
104 String amount::make_string(void)
109 s = String(value / 100) + ".";
110 decimals = String(value % 100);
113 decimals = "0" + decimals;