Coffee Time application
{list, loops (optional), conditions}
You are going to develop one of the most important and crucial applications for the hitech.
Prehistory. The best hi-tech companies in Israel and in the whole world are very interested in satisfying their employees. One of the best ways to do it is to bring a great coffee to the company. Some sophisticated companies are hiring baristas for a full time job.
So, currently all the hi-tech employees are suffering from a variety of coffee choices.
You are going to solve this problem for them.
You are going to build an application that receives a time of the day and and the number of friends who will drink the coffee together, and returns the type of coffee your hi-tech employees are going to drink according to the logic explained bellow.
Types of coffee: 24 types (see the attached image)
Use Case for the explanation:
- Time ⇒ 14:03
- Number of friends having a coffee together: 3 (user #1 plus 2 friends)
The flow of the app:
- User enters the time when he wants to drink a coffee in 24h format. (Ex: 14:03)
- User enters the number of employees who are going to have a coffee with him. If the user is alone - the input should be equal to 1.
- The app should return the coffee name according to:
- The first user should have a coffee number according to the hour that user entered. In our example (14:03) ⇒ user #1 should have a coffee #14, which is (from left to right and from top to bottom) = “MOCHA”
- The every next friend that comes to have a coffee with user #1 (in our use case there are additional 2 friends)
- Having the coffee number of the previous user + number of minutes that user #1 entered.
- Friend #2 will order the coffee number #14 + 3 = #17 (“RAF COFFEE”)
- Friend #3 will order the coffee number #14+3+3 = #20 (“CHOCOLATE MILK”)
- If you reach the end of the coffee list when adding numbers, continue from the beginning of the list. For example, for the input:
Time: 14:40 and Friends: 2, you should display:
Coffee #14 (MOCHA), and coffee #26 (Cappuccino Freddo).
Coffee #26 was calculated as follows: 14 + 40 = 54 (we got further than the end of the list). We have a total of 28 items in the list, so 54 % 28 = 26 - this is the number we are looking for.
Notes:
- Start from solving the easier case of this question that does not require using loops. Assume that the number of friends is limited to a maximum of two.
- After you finish the easier version of the exercise, try implementing the original version that allows you to insert any number of friends. This will require using loops!
- Make sure to validate user inputs!
BONUS #1
- The user can enter the starting number, let’s say user entered number 2 ⇒ so the user #1 , which entered the time 14:12 will have a coffee #14+2 = #16 (“BREVE”)
BONUS #2
- Users can enter the list of the coffee numbers that should be excluded from this iteration.
![](https://lh7-us.googleusercontent.com/docsp/AMfWKRBSc3FJf0EMGyo4Ohmrkf9s8oNK59ViSZpPMJdR3zZcdoZZ6yuwoSQLJHXvsJhwTWiZ_8IaQBc8rC16TVEBBqVONYnKcopDPh2_JoKJQvo77VN3C86J_Rp_-8_J0LXthU8WprPoGPMnUwgQ-nkhcQMQLbtY5C5jv7TjYBw6EMwT8oMDvE47MtfTLUYuynUoBSNvI7sn)
Inputs and expected outputs:
Expected output: ☕ numbers: #11 (CAFFE LATTE), #5 (MACCHIANTO), #27 (CARAMEL FRAPPE), #21(LATTE MACCHIATO)
Expected output: ☕ numbers: #9 (CAPPUCCINO), #9 (CAPPUCCINO)
- Input: 17:05, 2 friends, skip coffee numbers: 10, 20
Expected output: ☕ numbers: #18 (MEAD RAF), #24 (IRISH COFFEE)