"PRODUCT_NAME","PRODUCT_CATEGORY","SALES_PRICE"
"Hair Gel","Beauty",6.99 "Scotch tape","Office Supply",2.99
"Office Chair","Office Supply",134.99
"Eraser","Office Supply",0.99
"Lipstick","Beauty",9.99
"Nail Polish","Beauty",8.99
"Note Book","Office Supply",2.99
"Flower Pot","Home & Gardening",22.76
"Garden Hose","Home & Gardening",12.87
This format is referred to as a CSV (Comma Separated Values). Review this and understand what kind of data it is. The first line is called the header. The lines following the header is the actual data in the respective order. Each attribute is separated with a comma hence the name.
Requirements: To work on this assignment, first you need to create a file called products.csv in your eclipse workspace and paste the above data in that file.
Your program should read through the file and compute the following calculations. 1). The average price for each product_category. 2). The total sales value for each product_category. 3). The number of products in each product_category. 4). The most expensive item in each product_category.
Your program should print to the screen the information. Here is an example of how it should be printed out:
Beauty
average_price = 8.66
total_sales_value = 25.97
number_of_products = 3
most_expensive = 9.99
Office Supply
average_price = xxxx etc etc...
"PRODUCT_NAME","PRODUCT_CATEGORY","SALES_PRICE" "Hair Gel","Beauty",6.99 "Scotch tape","Office Supply",2.99 "Office Chair","Office Supply",134.99 "Eraser","Office Supply",0.99 "Lipstick","Beauty",9.99 "Nail Polish","Beauty",8.99 "Note Book","Office Supply",2.99 "Flower Pot","Home & Gardening",22.76 "Garden Hose","Home & Gardening",12.87This format is referred to as a CSV (Comma Separated Values). Review this and understand what kind of data it is. The first line is called the header. The lines following the header is the actual data in the respective order. Each attribute is separated with a comma hence the name.
Requirements:
To work on this assignment, first you need to create a file called products.csv in your eclipse workspace and paste the above data in that file.
Your program should read through the file and compute the following calculations.
The average price for each product_category.
The total sales value for each product_category.
The number of products in each product_category.
The most expensive item in each product_category.
Your program should print to the screen the information. Here is an example of how it should be printed out:
Beauty ---------------------------------- average_price = 8.66 total_sales_value = 25.97 number_of_products = 3 most_expensive = 9.99 Office Supply ---------------------------------- average_price = xxxxetc etc...
Here is how i solved it: Here is how i solved it:
Firstly, is there a better way to send in codes for reviews on this site? I mean like send in a jar file and it can be opened and lastly; most importantly, I just need to get your feedback on areas to improve in the coding.
ThanksI just need to get your feedback on areas to improve in the coding.