Walmart phone Interview questions
Anonymous User
919

We have a product class

class Product{
String productName;
String category;
Double SoldAmount;

Public Product(){
}
}
write a function to get the sum of SoldAmount according to their category.
Input: List < Product > products

Output:
For example:
{“Toshiba”, “TV”, 40,000}
{“Samsung”, “TV”, 30,000}
{“GE”, “Appliance”, 20,000 }
{“Panasonic”, “Appliance”, 10,000}

Sum of SoldAmount of TV -> 40,000 + 30,000 = 70,000
Sum of SoldAmount of Appliance -> 20,000 + 10,000 = 30,000

Comments (3)