c6 Read in the following data from a text file has been save

c#6

Read in the following data from a text file (has been saved in JSON format )

Output the data to the console:

[{\"Name\":\"4 Person Tent\",\"SKU\":\"CA24398\",\"Color\":\"Blue\",\"Quantity\":2,\"PriceEach\":99.99},{\"Name\":\"Sleeping Bag\",\"SKU\":\"CA98345\",\"Color\":\"Red\",\"Quantity\":4,\"PriceEach\":64.99},{\"Name\":\"Fly Rod\",\"SKU\":\"FI3048-P\",\"Color\":\"Brown\",\"Quantity\":7,\"PriceEach\":129.99},{\"Name\":\"Tackle Box\",\"SKU\":\"FI7423-T\",\"Color\":\"Tan\",\"Quantity\":20,\"PriceEach\":19.99},{\"Name\":\"Deer Stand\",\"SKU\":\"HU1337X\",\"Color\":\"Camo\",\"Quantity\":2,\"PriceEach\":84.99}]

Output should be as follows:

Create a collection of that class and populate from the JSON data

Calculate the total inventory cost of the list and print to the screen

Name 4 Person Tent SKU CA24398 Color Blue Quantit Price Each $99.99 Sleeping Bag Fly Rod Tackle Box CA98345 Red $64.99 F13048-P FI7423-T HU1337X Brown $129.99 Tan 20 $19.99 Deer Stand Camo $84.99

Solution

we have created as collectione as products in db please use as following code for the same.

db.products.aggregate([

{ $group:{ _id : null, total: {$sum: \"$Quantity\"}}

}

])

c#6 Read in the following data from a text file (has been saved in JSON format ) Output the data to the console: [{\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site