In this program, I want each list to have corresponding values. For example, spot 0 in each list should have attached values.
The output I want is to remove the identical values from 'value' and get the sum of the numbers for every corresponding 'valueA' and 'valueB' for the initial 'value' letter.
Ex)
a-
valueA sum = 14.4
valueB sum = 19.9
b-
valueA sum = 16.8
valueB sum = 10.3
Would this work better if the list was multi-dimensional? Sorry if this is a bad question, but I am struggling to accomplish this.
import java.util.ArrayList;
import java.util.List;
public class codehelp {
public static List<String> value = new ArrayList<>();
public static List<Double> valueA = new ArrayList<>();
public static List<Double> valueB = new ArrayList<>();
public static void main(String[] args) {
value.add("a"); //add some values to the first list
value.add("a");
value.add("b");
value.add("b");
valueA.add(5.3); //add some values to the second list
valueA.add(9.1);
valueA.add(15.3);
valueA.add(1.5);
valueB.add(19.3); //add some values to the third list
valueB.add(.6);
valueB.add(6.3);
valueB.add(4.0);
//code here
}
}