forked from WDI-SEA/object-array-drills
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbonus.js
82 lines (77 loc) · 3.42 KB
/
bonus.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
/////////////////////////////////////////////////////
// Bonus: More Tasks With Conditionals and Iteration
/////////////////////////////////////////////////////
// 1. There is a Talking Heads concert at DAR Constitutional Hall, and
// the attending dignitaries will be sitting in three sections:
// "left", "center", and "right".
//
// The event is "open seating" (guests can choose any seat they want),
// however they must have a *premium ticket* to sit in first 3 rows of
// their section. *Standard ticket*-holders must sit behind row 3.
// Using the hardcoded list of dignitaries below, print out
// appropriate seating instructions.
//
// Example:
// const ticket1 = {
// name: "Madeline Albright",
// section: "right",
// type: "premium",
// seats: 1
// }
// const ticket1 = {
// name: "Newt Gingrich",
// section: "center",
// type: "standard",
// seats: 4
// }
//
// Messages:
// "Welcome, Madeline Albright! You may sit anywhere in the first 3 rows of the right section."
// "Welcome, Newt Gingrich! You and your party may sit anywhere except first 3 rows of the center section.
// Please be sure to leave no seats between you."
const ticketSections = [
{name: "Boutros Boutros-Ghali", section: "center", type: "premium", seats: 1},
{name: "Ann Richards", section: "left", type: "premium", seats: 2},
{name: "George Will", section: "left", type: "standard", seats: 2},
{name: "Marion Barry", section: "center", type: "standard", seats: 8},
{name: "Warren Christopher", section: "right", type: "standard", seats: 1},
{name: "Bob Dole", section: "center", type: "premium", seats: 3}
]
// 2. There is a concert at the LA County Fairgrounds by the Southland's
// hottest Talking Heads tribute band for zombie afficianados,
// "The Wailing Deads" (known as "The Walking Deads" until they received
// a cease-and-desist). Ticket prices are $50, $65, or $90 for
// standard, premier, and premier plus seating. Premier plus tickets
// receive free drinks.
//
// Discounted patrons (seniors, veterans, and students) receive a free
// $10 drinks voucher, while regular patrons receive none. Premier
// plus seats only cost $80 for discounted patrons.
//
// Everyone who dresses as a zombie in a giant business suit will
// receive a $10 drinks voucher.
//
// Based on a ticket request in the form of an object, print out
// a message for the given ticket.
//
// Treat missing data as an automatic false.
//
// Examples:
// - {amount: 50.00, discount: true, zombie: false} => "STANDARD $10 DRINKS"
// - {amount: 65.00, discount: false, zombie: false} => "PREMIER NO DRINKS"
// - {amount: 80.00, discount: false} => "ERROR: INVALID TICKET"
// - {amount: 80.00, discount: true} => "PREMIER PLUS"
// - {amount: 90.00} => "PREMIER PLUS"
// - {amount: 50.00, discount: true, zombie: true} => "STANDARD $20 DRINKS"
const tickets = [
{amount: 50.00, discount: false, zombie: true},
{amount: 60.00, discount: true, zombie: false},
{amount: 50.00},
{amount: 65.00, discount: true, zombie: true},
{amount: 90.00, discount: false},
{amount: 50.00, discount: true, zombie: false},
{amount: 50.00, zombie: true},
{amount: 80.00, discount: true},
{amount: 90.00},
{amount: 50.00, discount: true}
]