forked from christianhujer/expensereport
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpenseReport.ps
More file actions
65 lines (60 loc) · 1.13 KB
/
ExpenseReport.ps
File metadata and controls
65 lines (60 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/dinner 1 def
/breakfast 2 def
/car_rental 3 def
/printReport {
(Expenses:) =
dup
{
dup 0 get
dup dinner eq { pop (Dinner)} {
dup breakfast eq { pop (Breakfast) } {
dup car_rental eq { pop (Car Rental) } {
pop ()
} ifelse
} ifelse
} ifelse
print
(\t) print
dup 1 get 10 string cvs print
(\t) print
dup
dup 0 get dinner eq 2 1 roll 1 get 5000 gt and
2 1 roll
dup 0 get breakfast eq 2 1 roll 1 get 1000 gt and
or
{ (X) }
{ ( ) }
ifelse print
(\n) print
} forall
dup
(Meal Expenses: ) print
0
2 1 roll
{
dup dup
0 get
dinner
eq
2 1 roll
0 get
breakfast
eq
or
{ 1 get }
{ pop 0 }
ifelse
add
} forall
=
(Total Expenses: ) print
0
2 1 roll
{
1 get
add
} forall
=
} def
[[dinner 5000] [dinner 5001] [breakfast 1000] [breakfast 1001] [car_rental 4]]
printReport