# Scenario: Water Park
It's summer and you know it! All the water parks around your neighborhood are open and they need help with keeping track of their logistics. You will be helping them with handling the amount of people that are in the water park as well as provide tools for the business.
Here are some of the attributes of the data regarding the water park:
- `name` – (string) name of the customer
- `discount` – (boolean) whether they used a discount or not
- `passType` – (string) representing either 'basic', 'gold', 'premium'
- `partySize` – (integer) how many people came with them
- `restricted` (boolean) restricted to certain water slides due to height
Below is an example of how the current data looks like on a when the park is open:
```javascript
let customers = [
{ name: 'john', discount: true, passType: 'premium', partySize: 6, restricted: false },
{ name: 'kelly', discount: true, passType: 'basic', partySize: 4, restricted: false },
{ name: 'martha', discount: false, passType: 'gold', partySize: 1, restricted: true },
{ name: 'memo', discount: false, passType: 'premium', partySize: 3, restricted: true },
{ name: 'walter', discount: false, passType: 'gold', partySize: 4, restricted: true },
];
```
### Feature Request: How many total customers during a day?
The water park business would like to know how many *customers* total came on a given day.
Given the array of `customers`, create a function called `totalCustomers(customers)` that returns the total amount of customers that came on a given day.
NOTE: do NOT count the party sizes, only the customers representing the party.
<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/water-park-1?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### Feature Request: How many total customers including their party sizes?
The water park business would like to know how many *people* TOTAL came on a given day.
Given the array of `customers`, create a function called `totalWithParties(customers)` that returns the total amount of customers that came on a given day.
<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/water-park-2?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### Feature Request: How many customers obtained a discount?
The water park business noticed they started losing money. They think it might be because they gave out too many discounts.
Given the array of `customers`, create a function called `totalCustomerDiscounts(customers)` that returns the total amount of customers that came with discount.
<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/water-park-3?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### Feature Request: Give customers discounts
The water park business wants to give discounts to customers with a party size greater than 5 (`partySize > 5`).
Given the array of `customers`, create a function called `giveDiscountsTo(customers)` that returns the updated `customers` array with each customer with a party size greater than 5 and given a discount showing in the database. For example:
```javascript
// Current database showing customers with no discount
let customers = [
{ name: 'john', discount: false, passType: 'premium', partySize: 6, restricted: false },
{ name: 'kelly', discount: false, passType: 'basic', partySize: 2, restricted: false }
]
// Function gets called
giveDiscountsTo(customers)
// Database gets updated and gives them discount if partySize > 5
// In this example, 'john' gets a discount since his partySize = 6
// ('john' discount changed from 'false' to 'true' )
let customers = [
{ name: 'john', discount: true, passType: 'premium', partySize: 6, restricted: false },
{ name: 'kelly', discount: false, passType: 'basic', partySize: 2, restricted: false }
]
```
<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/water-park-4?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### Feature Request: How much discount should we give?
Adding on to the previous feature request, the water park business would like to add a specific amount of discount depending on the pass type that the customer purchased.
For the customers that received a discount based on their party size, add the discount to the database based on the pass type they purchased in the form of decimal. Below are the discount amounts:
premium:`discountAmount = .30`
gold:`discountAmount = .20`
basic:`discountAmount = .10`
Below is an example of the function call:
```javascript
// Current database showing customers with no discount
let customers = [
{ name: 'john', discount: false, passType: 'premium', partySize: 6, restricted: false },
{ name: 'kelly', discount: false, passType: 'basic', partySize: 2, restricted: false }
]
// Function gets called
addDiscountAmounts(customers)
// Database gets updated and gives them discount if partySize > 5
// In this example, 'john' gets a discount since his partySize = 6
// ('john' discount changed from 'false' to 'true' )
// ('john' gets a discount of .20)
let customers = [
{ name: 'john', discount: true, passType: 'premium', partySize: 6, restricted: false, discountAmount: .20 },
{ name: 'kelly', discount: false, passType: 'basic', partySize: 2, restricted: false }
]
```
<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/water-park-5?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### Feature Request: Group customers in categories
The business would like to categorize the customers into groups accordingly by the amount of people they brought, particularly those that brought 4, 5, and 6 people (partySize = 4, 5, or 6).
From the customers database, analyze how many customers brought 4, 5, 6 (partySize = 4, 5, or 6). Below is an example of the function call:
```javascript
// Current database showing customers with no discount
let customers = [
{ name: 'john', discount: false, passType: 'premium', partySize: 6, restricted: false },
{ name: 'giselle', discount: false, passType: 'premium', partySize: 6, restricted: false },
{ name: 'michael', discount: false, passType: 'premium', partySize: 4, restricted: false },
]
// Function gets called
groupByParty(customers) // -> returns new object
// Returns a new object with customers organized by partySize:
{
4: ['michael'],
5: [],
6: ['giselle', 'michael']
}
```
<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/water-park-6?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>