15,115,667 members
See more:
```Club
A Local night Club is running a special on drinks. Write a program that calculates the profit of the
club for the evening and if the desired profit is reached.
Keeping in mind the following: The price of a cocktail is the length of its name. If the price of an
order is an odd number, there is a 25% discount on the order price.

Input
• First – the desired profit of the club - real number in the range [1.00... 15000.00]
• Second - An array of strings and numbers containing a pattern of the following:
o Name of the cocktail or command "Party!" - string
o The number of cocktails for the order - a whole number in the range [1... 50]
The program will do calculations until the command "Party!" appears in the array or until
the desired profit is reached.

Output
The expected output is a string containing:
• If the command "Party!" is read in before the desired profit is reached:
"We need {money needed} dollars more."
• If the desired profit is reached:
"Target acquired."
Then print:
"Club income - {club's profit} dollars."
The money must be formatted to the second digit after the decimal point.

Function Setup
function main(profitDesired, cocktailsAndAmounts){
}

Examples

500,
["Bellini",
6,
"Bamboo",
7,
"Party! "]"
We need 416.00 dollars more.
Club income - 84.00 dollars.

The goal of the club is to collect \$500.
The first order is for 6 Bellini cocktails.
The price of the cocktail is its name length
0-> 7. 6 Cocktails of \$7 -> \$42, the last digit
is 2, therefore there is no discount.
The next order is for 7 Bamboo cocktails, its
price is \$6. 6 * 7-> 42, again there is no
discount.
We receive the command Party! The
program stops.
The club has 42 + 42 = \$84 and the target
was 500. 500 – 84 = \$416 is needed.

100
["Sidecar",
7,
"Mojito",
5,
"White Russian",
10]

Target acquired.
Club income - 196.75 dollars.

The goal of the club is to collect \$100.
The first order is for 7 Sidecar cocktails. 7 *
7 = 49, the last digit is an odd number and
therefore 25% of the order price.
49 – 25% is \$36.75
The next order is for 5 Mojito cocktails, total
of \$30.
The next order is 10 cocktails White
Russian, total \$130
Until now the club has 36.75 + 30 + 130 =
\$196.75
The target of 100 dollars is reached and the
program ends.```

What I have tried:

I am new to JavaScript and need this problem done for my class. I am behind in my studies as it is taking some time for me to grasp the information.
Posted
Updated 5 days ago
0x01AA 5 days ago

"• Second - An array of strings", yep makes sense in a night club ;p
Dave Kreskowiak 5 days ago

I think you forgot to ask a question somewhere in there.

## Solution 1

Quote:
I am new to JavaScript and need this problem done for my class.
Then you need to get on and work out the solution. No one here is going to do the work for you.