forked from CodeNextAdmin/TeamEdgeTerm0
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathOrderBotProject.js
115 lines (52 loc) · 3 KB
/
OrderBotProject.js
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* --------------------------------------------
You've just learned about variables, conditionals, functions, and user input.
You've also created a basic calculator in a previous project.
Now imagine you are going out to eat with two other friends.
Are you at a restaurant for a meal? Are you grabbing boba? Or are you just going to an ice cream parlor?
At the end of the meal, you and your friends have to split the bill.
Wouldn't it be great if we could automate that math?
Let's try it!
--------------------------------------------
Scenario Parameters:
When you and your friends eat out, each of you have the option to order one or multiple items.
What kind of items are available to order?
At the end of the order, the receipt comes and you all have to calculate the cost for each person:
Don't forget the tax and tip!
After this program finishes running, it should output a specific total for each person
-------------------------------------------- */
const READLINE = require("readline-sync");
/* --------------------------------------------
Part 1:
Let's start by asking taking the order of the group(you and two friends). What did each person order?
Write a function that will take the group's order:
- Prompt the user to enter the price of each item they ordered
- Return the cost
Remember! Functions are meant to be reusable, so write a function that will work when called for each person!
-------------------------------------------- */
/* --------------------------------------------
Part 2:
Now that you have the costs of everything ordered, let's calculate the cost of each person's order(including tip and tax).
Write a function that will calculate the cost of each person's order, including:
- Cost of all of their ordered items
- Tax (Look up the sales tax of your city)
- Tip (Give the user the option to enter how much they want to tip)
Remember! Functions are meant to be reusable, so write a function that will work when called for each person!
-------------------------------------------- */
/* --------------------------------------------
Part 3:
Let's print out a receipt for each person.
Write a function that will take the values of each person's order and total cost and print it out in an appealing way.
The receipt should include:
- Cost of each item
- Total cost for each person
Remember! Functions are meant to be reusable, so write a function that will work when called for each person!
-------------------------------------------- */
/* --------------------------------------------
Part 4: Upchallenges!
How many of these upchallenges can you implement?
- Make sure the user is only entering numbers. If they enter an invalid value, prompt them to re-enter.
- The displayed prices should only have two decimal places.
- Can you adjust your program to account for any shared items ordered for the group?
- Display the tax and tip values
- Implement a rewards system (stamp cards, buy one get one, etc)
-------------------------------------------- */