给你们贡献点孩子的时间安排, 2项运动2项音乐# Parenting - 为人父母
l*c
1 楼
You are working at a grocery store and you are asked to track customers'
purchasing habits by scanning frequent shoppers cards. Your cash register
logs all transactions to a pipe--‐delimited ("|") flat text file in the
following format: customer_name|product_category|item_description|cost
An example log file is:
Pedro|groceries|apple|1.42
Nitin|tobacco|cigarettes|15.00
Susie|groceries|cereal|5.50
Susie|groceries|milk|4.75
Susie|tobacco|cigarettes|15.00
Susie|fuel|gasoline|44.90
Pedro|fuel|propane|9.60
All the items have a sales tax of 9.25%. Write a script/program (in your
language of choice) that will parse the log and generate the following
output:
1. A report of the total revenue from each customer
2. A report for each customer showing how much of their spending went to
each category.
3. Show the sales tax component for each of the reports.
With the above example log file, the script should output should look
something like:
Total revenue by customer:
Pedro - $11.02
Nitin - $15.00
Susie - $70.15
Purchases by Pedro:
groceries - $1.42
fuel - $9.60
Purchases by Nitin:
tobacco - $15.00
Purchases by Susie:
groceries - $10.25
fuel - $44.90
tobacco - $15.00
purchasing habits by scanning frequent shoppers cards. Your cash register
logs all transactions to a pipe--‐delimited ("|") flat text file in the
following format: customer_name|product_category|item_description|cost
An example log file is:
Pedro|groceries|apple|1.42
Nitin|tobacco|cigarettes|15.00
Susie|groceries|cereal|5.50
Susie|groceries|milk|4.75
Susie|tobacco|cigarettes|15.00
Susie|fuel|gasoline|44.90
Pedro|fuel|propane|9.60
All the items have a sales tax of 9.25%. Write a script/program (in your
language of choice) that will parse the log and generate the following
output:
1. A report of the total revenue from each customer
2. A report for each customer showing how much of their spending went to
each category.
3. Show the sales tax component for each of the reports.
With the above example log file, the script should output should look
something like:
Total revenue by customer:
Pedro - $11.02
Nitin - $15.00
Susie - $70.15
Purchases by Pedro:
groceries - $1.42
fuel - $9.60
Purchases by Nitin:
tobacco - $15.00
Purchases by Susie:
groceries - $10.25
fuel - $44.90
tobacco - $15.00