home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
tutor
/
l5p130
< prev
next >
Wrap
Text File
|
1990-07-15
|
4KB
|
99 lines
\ ╔════════════════════════════════════════════════════╗
\ ║ Lesson 5 Part 130 F-PC 3.5 Tutorial by Jack Brown ║
\ ╚════════════════════════════════════════════════════╝
\ Part four of CHKBOOK.SEQ
/* ************************************************************ */
/* */
/* Function: MAKE_A_DEPOSIT - calculates new balance after */
/* a deposit is made. */
/* */
/* Date: July 25, 1988 */
/* */
/* Interface: MAKE_A_DEPOSIT ( --) */
/* */
/* Notes: Calls add_to_bal to perform fixed point calculations. */
/* */
/* ************************************************************ */
: MAKE_A_DEPOSIT ( -- )
40 CLR_HBAR
." Enter the amount of the deposit: " CR
40 HBAR
GET_DOLLARS TR_DOLLARS !
GET_CENTS TR_CENTS !
1 DEP_COUNT +!
TR_DOLLARS @ DEP_DOLLARS @ +
TR_CENTS @ DEP_CENTS @ +
ROUND DEP_CENTS ! DEP_DOLLARS !
40 HBAR
TR_DOLLARS @ TR_CENTS @ ADD_TO_BAL
." After a deposit of "
TR_DOLLARS @ TR_CENTS @ $XX.XX CR
." your new balance comes to: "
BAL_DOLLARS @ BAL_CENTS @ $XX.XX CR
40 HBAR ;
/* ************************************************************ */
/* */
/* Function: NET_CHANGE Displays net change from session */
/* start. */
/* */
/* Date: July 25, 1988 */
/* */
/* Interface: NET_CHANGE ( -- ) */
/* */
/* ************************************************************ */
VARIABLE DIF_DOLLARS
VARIABLE DIF_CENTS
: NET_CHANGE ( -- )
BAL_DOLLARS @ DIF_DOLLARS !
BAL_CENTS @ DIF_CENTS !
OLD_CENTS @ BAL_CENTS @ >
IF -1 DIF_DOLLARS +!
100 DIF_CENTS +!
THEN
OLD_DOLLARS @ NEGATE DIF_DOLLARS +!
OLD_CENTS @ NEGATE DIF_CENTS +!
40 CLR_HBAR
." Net change this session: "
DIF_DOLLARS @ 0 <
IF 100 DIF_CENTS @ - DIF_CENTS !
1 DIF_DOLLARS @ + NEGATE DIF_DOLLARS !
ASCII - EMIT
THEN
DIF_DOLLARS @ DIF_CENTS @ $XX.XX CR
40 HBAR ;
/* ************************************************************ */
/* */
/* Function: TOT_CHECKS Displays total checks written */
/* this session. */
/* */
/* Date: July 25, 1988 */
/* */
/* Interface: TOT_CHECKS ( -- ) */
/* */
/* ************************************************************ */
: TOT_CHECKS ( -- )
70 CLR_HBAR
CHK_COUNT @ 0=
IF
." There have been no checks written so far this session "
." so the total is: "
ELSE CHK_COUNT @ 1 =
IF
." Only one check has been written so far this session "
." for a total of: "
ELSE
." There were " CHK_COUNT @ .
." checks written so far this session "
." that total: "
THEN
THEN
CHK_DOLLARS @ CHK_CENTS @ $XX.XX CR
70 HBAR ;