I have 3 classes:
- Calculation class (includes FinalPrice() method which is return with a double value)
- File Reader class (Load CSV file, split data into an array and return with the first element of the array, which is a String. Includes getType() method)
- Contract class(only contains a constructor)
File a = new File("D:\\...\\contract.csv"); Calculation1 calc = new Calculation1(a); File_Reader1 b = new File_Reader1(); Contract c = new Contract(b.getType(a),calc.FinalPrice());
I need a list to store Contract objects and grouping the keys (which is b.getType(a) ) and sum their values (which is calc.FinalPrice() ), like
Input (for example):
list.add("AB", 5); list.add("AC", 8); list.add("AB", 12);
I would like to get an output like this:
"AB" : 17 "AC" : 8
Can anyone help me?