Can you help me understand how to do this step by step? 2. (15 points) ChezWolfie.java: Create
Question:
Can you help me understand how to do this step by step?
2. (15 points) ChezWolfie.java: Create a function cafe_day(orders) which takes one argument, orders, which is a double dimensional array of int drink orders for the day at a cafe. The array orders contains one or more sub-arrays, in which each sub-array represents a particular drink order. In each sub-array, there are four elements, in this order:
An integer that indicates the customer's membership, which will be one of these three categories:
Platinum membership is represented by the number 2
Gold membership is represented by the number 1
Silver membership is represented by the number 0
An integer that represents the number of large drinks for the particular order.
An integer that represents the number of medium drinks for the particular order.
An integer that represents the number of small drinks for the particular order.
Your function should process all orders, then return a floating-point number that represents the revenue generated for the day in dollars. Don't round the return value! The prices for different sizes are as follows:
Drink Size Price
Large $3.50
Medium $2.50
Small $1.25
Platinum: If the customer purchases 3 or more large drinks, OR 4 or more medium drinks, then he/she gets at most 3 free small drinks.
Gold: If the customer purchases at least 10 drinks (in any combination of small, medium and large), then he/she gets a 20% discount.
Silver: The customer receives 2% off of total price regardless of number of drinks ordered.
Invalid values: Your function should be able to handle invalid values outlined below. In these cases, skip the entire drink order and continue to the next one. Valid drink orders have the following characteristics:
Each sub-list has exactly four values.
The first element in the sub-list, which is the membership, is one of the three ints2, 1 or 0 (all lowercase letters are invalid).
The number of drinks for all three sizes is greater than or equal to zero.
If the orders list is empty, the function should simply return 0.0.
Examples
cafe_day(new int[][]{{5, 1, 2, 3}, {2, 5, 0, 4}, {1, 4, 4, 2}})
39.95
cafe_day(new int[][]{{1, 4, 3, 2}, {0, 0, 0, 10}, {2, 1, 4, 3}})
49.75
Introduction to Managerial Accounting
ISBN: 978-1259105708
5th Canadian edition
Authors: Peter C. Brewer, Ray H. Garrison, Eric Noreen, Suresh Kalagnanam, Ganesh Vaidyanathan