Skip to content

Commit e0cbd79

Browse files
committed
Point of Sale System
1 parent 4864e95 commit e0cbd79

File tree

3 files changed

+98
-9
lines changed

3 files changed

+98
-9
lines changed

src/SUMMARY.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ HTML
7070
7171
Make your own iterator
7272
73+
# Projects II
74+
75+
https://michaelxing.com/UltimateTTT/v3/
76+
- [Ultimate Tic-Tac-Toe]()
77+
78+
Circuit Builder Resistance Solver
79+
80+
Draw a circuit.
81+
82+
Adjacency Matrix
83+
84+
BFS
85+
7386
-->
7487

7588
# Modern Java
@@ -279,11 +292,6 @@ Make your own iterator
279292
- [Unreachable Statements](./return_values/unreachable_statements.md)
280293
- [Challenges](./return_values/challenges.md)
281294

282-
# Projects
283-
284-
<!-- chicken nugget number type things come up when dispensing change -->
285-
- [Point of Sale System](./projects/point_of_sale_system.md)
286-
287295
# Data Types III
288296

289297
- [null](./null.md)
@@ -307,10 +315,10 @@ Make your own iterator
307315
- [Populate Arrays](./arrays_ii/populate_arrays.md)
308316
- [Challenges](./arrays_ii/challenges.md)
309317

310-
# Projects II
318+
# Projects
311319

312-
<!-- https://michaelxing.com/UltimateTTT/v3/ -->
313-
- [Ultimate Tic-Tac-Toe]()
320+
<!-- chicken nugget number type things come up when dispensing change -->
321+
- [Point of Sale System](./projects/point_of_sale_system.md)
314322

315323

316324
# Code Structure II

src/projects/ascii_art.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ not a number you don't just crash. This means you might need to reprompt them fo
144144
||
145145
```
146146

147+
* Draw both the snowman and a tree. Let the user select which goes on the left and which goes on the right.
147148

148149
* Turn this into a command-line program that works similarly to the [cowsay](https://en.wikipedia.org/wiki/Cowsay#:~:text=cowsay%20is%20a%20program%20that,a%20cow%20with%20a%20message.) tool.
149150

@@ -156,4 +157,6 @@ not a number you don't just crash. This means you might need to reprompt them fo
156157
(__)\ )\/\
157158
||----w |
158159
|| ||
159-
```
160+
```
161+
162+
* Expand or refocus into drawing other kinds of things.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,79 @@
11
# Point of Sale System
2+
3+
## Problem Statement
4+
5+
Consider the operations of a grocery store.
6+
7+
Prospective customers walk in the store, perhaps acquiring a cart or a basket,
8+
and gather the items they want to purchase. They then walk to the front of the
9+
store, purchase those items using money, and leave.
10+
11+
Some items are priced by quantity. For example, one [avacado](https://en.wikipedia.org/wiki/Avocado) might cost $0.77.
12+
If they purchased 5 avacados they would have to pay $0.77 five times or $3.85 in total.
13+
14+
Other items are priced by weight. Bananas are [really cheap for some reason](https://en.wikipedia.org/wiki/Banana_republic)
15+
and so 1 pound of bananas costs $0.39. If they purchase 1.5 pounds of bananas they would have to pay 1.5 times $0.39 or $0.585 in total. Currencies like the dollar do not have a "tenth of a penny" so after this math the amount will be rounded
16+
either to $0.58 or $0.59 depending on the policy of the store in question.
17+
18+
Either way it is uncommon for someone to have exactly $3.85 or $0.59 on their person. So to facilitate purchases
19+
using physical money they must accept larger bills and offer change for the difference. If someone tries to use a $10 bill
20+
to buy $3.85 of avacados the store will provide $6.15 back to the customer in change.
21+
22+
While a business can operate this way without any sort of computer involved there are several benefits to having one.
23+
24+
The price a store wants to charge for any given item is bound to change over time. When training a cashier it can make
25+
more sense to teach them short codes for different items and have the computer system figure out the price to use[^plu]. This would generally include telling them to weigh an item or count the quantity of said item.
26+
27+
In addition to the price, calculating change is easy for computers to do. While it is not hard for a human to do either,
28+
a computer will make fewer mistakes calculating the difference between $45 and $13.53. This is especially true over the course of an 8 hour shift where mental fatigue can start to set in.
29+
30+
It is also helpful for a business to know how much they sold in a given day. Having computers in the mix makes it more practical to get these "end of day reports." They might use these reports to know that they need to order more onions because those are selling well recently.[^viral] They can also be used to catch cashiers who are stealing from the register
31+
to support their families.[^common]
32+
33+
We call these systems that are used at the point products are sold Point of Sale Systems.
34+
35+
## Your Goal
36+
37+
Make a program that can be used as a point of sale system for a hypothetical produce stand.
38+
39+
The products the produce stand sells are as follows:
40+
41+
| Item | Cost |
42+
|------|------ |
43+
| Banana | $0.39 per pound |
44+
| Avacado | $0.66 each |
45+
| Plantains | $0.99 each |
46+
| Watermelon | $6.99 each |
47+
| Onion | $0.62 each |
48+
| Celery |$0.31 per ounce|
49+
| Carrot |$0.06 per ounce|
50+
| Cabbage |$2.72 each|
51+
52+
Customers may purchase any amount of any items in any combination.
53+
54+
Make sure to:
55+
56+
* Track the total for an order.
57+
* Prompt the cashier for the right quantities and weights.
58+
* At the end of an order give the cashier the total and have them enter the amount given to them by the customer.
59+
* Tell the cashier how much in change they need to provide.
60+
61+
## Future Goals
62+
63+
* Grow your program to support double or triple the number of available items.
64+
* Make it so that the cashier has to "log in" to use the system
65+
* Account for a manager whose job it is to record how much money is in the register before and after a day of operations
66+
and note any unaccounted for funds.
67+
* Make the program not lose information if the computer running it turns off then on again.
68+
* Make the system work for "self check out," where the person entering the items is also the customer. Theft in
69+
these cases is monitored via security cameras and punished via the might of the police state.
70+
* Use a camera attached to the computer to scan a bar code which contains the product number
71+
* Optionally print a receipt for each order to a physical printer.
72+
73+
74+
75+
[^plu]: Here is a list of "[PLU](https://www.fsproduce.com/wp-content/uploads/2015/05/2011-PLU-Listing1.pdf)" codes. 4011 is banana.
76+
77+
[^viral]: Due to a viral onion tart recipie or something.
78+
79+
[^common]: This is common in no small part because cashiers, like many modern professions, are not paid a livable wage.

0 commit comments

Comments
 (0)