Please, how would you get the average for quantity of the same date from the following data in kotlin.
A function to take this input and return an object with {"Monday" : 3.40, "Tuesday": 4.5}
and a brief explanation how to pass the data into the function (because it doesn't have specific task) will be much appreciated.
mapOf(
"orderId" to 554,
"creationDate" to "2017-03-25T10:35:20",
"orderLines" to arrayOf(
mapOf("productId" to 9872, "name" to "pencil", "quantity" to 3, "unitPrice" to 3.00)
)
),
mapOf(
"orderId" to 555,
"creationDate" to "2017-03-25T11:24:20",
"orderLines" to arrayOf(
mapOf("productId" to 9872, "name" to "Pencil", "quantity" to 1, "unitPrice" to 3.00),
mapOf("productId" to 1746, "name" to "Eraser", "quantity" to 1, "unitPrice" to 1.00)
)
),
mapOf(
"orderId" to 453,
"creationDate" to "2017-03-27T14:53:12",
"orderLines" to arrayOf(
mapOf("productId" to 5723, "name" to "Pen", "quantity" to 4, "unitPrice" to 4.22),
mapOf("productId" to 9872, "name" to "Pencil", "quantity" to 3, "unitPrice" to 3.12),
mapOf("productId" to 3433, "name" to "Erasers Set", "quantity" to 1, "unitPrice" to 6.15)
)
),
mapOf(
"orderId" to 690,
"creationDate" to "2017-03-26T11:14:00",
"orderLines" to arrayOf(
mapOf("productId" to 9872, "name" to "pencil", "quantity" to 4, "unitPrice" to 3.12),
mapOf("productId" to 4098, "name" to "Marker", "quantity" to 5, "unitPrice" to 4.50)
)
)```