Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2153

Need Help with some code. Not sure why it's not working. Can someone please take a look?

Newsgroups comp.lang.java.help
Date 2012-10-12 19:10 -0700
Message-ID <b643cfda-6dda-4d8d-aa1a-1ae01740291b@googlegroups.com> (permalink)
Subject Need Help with some code. Not sure why it's not working. Can someone please take a look?
From ortizgabriel79@gmail.com

Show all headers | View raw


It keeps saying that type ArrayList is not generic and cannot be parametierized with arguments <Double> 

AND that Parameterized types are only available if source type is 5.0

I'm using Eclipse to comiple everything. 





public static void main(String args[]) {
    DecimalFormat df = new DecimalFormat("###,###.00");
    double[] PRICE_ARRAY = { 10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, 3.98 };
    double[] QUANTITY_ARRAY = { 4.0, 8.5, 6.0, 7.35, 9.0, 15.3, 3.0, 5.4, 2.9, 4.8 };
    ArrayList<Double> priceList = new ArrayList<Double>();
    ArrayList<Double> quantityList = new ArrayList<Double>();
    ArrayList<Double> amountList = new ArrayList<Double>();

    for (int i=0; i < 10; i++){
        priceList.add(new Double(PRICE_ARRAY[i]));
        quantityList.add(new Double(QUANTITY_ARRAY[i]));
    }

    result = "";
    for (int i = 0; i < 10; i++) {
        amountList.add((Double.valueOf(priceList.get(i).toString())) * (Double.valueOf(quantityList.get(i).toString())));
        result += String.valueOf(i+1) + ")  "
               + new String(df.format(priceList.get(i))) + " * "
               + new String(df.format(quantityList.get(i))) + " = "
               + new String(df.format(amountList.get(i))) + "\n";

Back to comp.lang.java.help | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Need Help with some code. Not sure why it's not working. Can someone please take a look? ortizgabriel79@gmail.com - 2012-10-12 19:10 -0700
  Re: Need Help with some code. Not sure why it's not working. Can someone please take a look? Lew <lewbloch@gmail.com> - 2012-10-12 22:42 -0700
  Re: Need Help with some code. Not sure why it's not working. Can someone please take a look? Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-10-13 09:23 -0400
  Re: Need Help with some code. Not sure why it's not working. Can someone please take a look? John Dildy <jdildy85@gmail.com> - 2012-12-02 13:56 -0800

csiph-web