473,714 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

output Array help

5 New Member
I am doing an inventory control progam and trying to output a multiple array, I am getting an illegal conversion error java.lang.doubl e !d. Can somebody tell me what I am doing wrong or if there is another way?

Expand|Select|Wrap|Line Numbers
  1. /*
  2.  * Main.java
  3.  *
  4.  * Created on April 29, 2007, 6:57 PM
  5.  *
  6.  * To change this template, choose Tools | Template Manager
  7.  * and open the template in the editor.
  8.  */
  9.  
  10. package inventory2;
  11.  
  12. /**
  13.  *
  14.  * @author SandK
  15.  */
  16. import java.util.*;
  17. import java.text.*;
  18. import java.lang.*;
  19. import javax.swing.*;
  20. import java.awt.event.*;
  21. import java.awt.*;
  22. import java.text.DecimalFormat;
  23. public class Main
  24. {  //declare variables
  25.    private static String Choice;
  26.    private static double movieTotal;
  27.    private static double movieValue;
  28.    private static double gameTotal;
  29.    private static double gameValue;
  30.    private static double appsTotal;
  31.    private static double appsValue;
  32.    private double movieNumber[][];
  33.    private double gameNumber[][];
  34.    private double appsNumber[][];
  35.    private Product[] stores;
  36.    double itemNumber[][];
  37.    static double value;
  38.    static double grandTotal;
  39.  
  40.  
  41.    public static void main(String[] args)
  42.    {//set values for multiple array
  43.        //assign empty set to clear final variable
  44.        double itemNumber[][] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} };
  45.         //assign values to Movie array  
  46.        double movieNumber[][] = { {5,10,29.95}, {6,15,24.95}, {7,20,14.95},
  47.                                   {8,20,15.95} };
  48.        //assign values to Game array
  49.        double gameNumber[][] = { {9,10,229.95}, {10,5,199.95}, {11,4,4999.95},
  50.                                  {12,20,699.95} };
  51.        //assign value to Apps array
  52.        double appsNumber[][] = { {1,10,19.95}, {2,25,25.95}, {3,20,20.95},
  53.                                  {4,15,19.95} }; 
  54.  
  55.        Main inventory = new Main(); 
  56.           {
  57.        Scanner input = new Scanner (System.in);
  58.        //Query user for inventory to view
  59.        System.out.println("Would you like to view the movies, games, or apps inventory?");
  60.        String userChoice = input.nextLine();
  61.        Choice = userChoice;
  62.        //Load values into array for movies selection
  63.        if( userChoice.equalsIgnoreCase("movies"))
  64.        { 
  65.  
  66.          //add new DVD's to inventory  
  67.          //Create subclass objects for DVD subclass including style
  68.          inventory.addProduct(new DVD("White Noise", 1, 10, 19.95, "Action"));
  69.          inventory.addProduct(new DVD("Jeff Foxworthy", 2, 25, 25.95, "Comedy"));
  70.          inventory.addProduct(new DVD("Cars", 3, 20, 20.95, "Comedy"));
  71.          inventory.addProduct(new DVD("Monster-In-Law", 4, 15, 19.95, "Comedy"));
  72.         //assign multiple variable movieNumber[][] to 
  73.         //itemNumber[][] for array output         
  74.         for (int disc = 0; disc < itemNumber.length; disc++)
  75.         {
  76.             for(int column = 0; column < itemNumber[disc].length; column++)
  77.             {
  78.              itemNumber = movieNumber;
  79.             }
  80.          }
  81.  
  82.        }
  83.        else if (userChoice.equalsIgnoreCase("games")) 
  84.        { 
  85.         //add new games to inventory
  86.         //Create subclass objects for Game subclass without style
  87.         inventory.addProduct(new Games("Command and Conquer", 5, 10, 29.95 ));
  88.         inventory.addProduct(new Games("Delta Force II", 6, 15, 24.95));
  89.         inventory.addProduct(new Games("Roller Coaster Tycoon", 7, 20, 14.95));
  90.         inventory.addProduct(new Games("Half-Life", 8, 20, 15.95));
  91.         //assign multiple variable gameNumber[][] to 
  92.         //itemNumber[][] for array output
  93.         for (int disc = 0; disc < itemNumber.length; disc++)
  94.         {
  95.             for(int column = 0; column < itemNumber[disc].length; column++)
  96.             {
  97.              itemNumber = gameNumber;
  98.             }
  99.          }
  100.  
  101.  
  102.        }
  103.        else if (userChoice.equalsIgnoreCase("apps")) 
  104.        { 
  105.         //add new games to inventory
  106.         //Create subclass objects for Game subclass with style
  107.         inventory.addProduct(new Apps("Wiindows Vista 32 bit", 9, 10, 229.95,
  108.                                       "Operating System" ));
  109.         inventory.addProduct(new Apps("Windows Vista 64 bit", 10, 5, 199.95,
  110.                                       "Operating System"));
  111.         inventory.addProduct(new Apps("Autocad 2007", 11, 5, 4999.95, "Drafting"));
  112.         inventory.addProduct(new Apps("Microsoft Office 2007", 12, 20, 699.95,
  113.                                       "Business"));
  114.         //assign multiple variable appsNumber[][] to 
  115.         //itemNumber[][] for array output
  116.         for (int disc = 0; disc < itemNumber.length; disc++)
  117.         {
  118.             for(int column = 0; column < itemNumber[disc].length; column++)
  119.             {
  120.              itemNumber = appsNumber;
  121.             }
  122.          }
  123.        }
  124.   //Determine individual totals for arrays to compute grand total
  125.         //Compute movie total from array for part of grand total
  126.         for (int disc = 0; disc < movieNumber.length; disc++)
  127.         {
  128.             for(int column = 0; column < movieNumber[disc].length; column++)
  129.             {
  130.              movieValue = movieNumber[disc][1] * itemNumber[disc][2];
  131.              movieTotal += movieValue;
  132.             }
  133.         }      
  134.         //Compute game total from array for part of grand total
  135.         for (int disc = 0; disc < gameNumber.length; disc++)
  136.         {
  137.             for(int column = 0; column < gameNumber[disc].length; column++)
  138.             {
  139.              gameValue = gameNumber[disc][1] * itemNumber[disc][2];  
  140.              gameTotal += gameValue;
  141.             }
  142.         }
  143.         //Compute apps total from array for part of grand total    
  144.         for (int disc = 0; disc < appsNumber.length; disc++)
  145.         {
  146.             for(int column = 0; column < appsNumber[disc].length; column++)
  147.             {
  148.              appsValue = appsNumber[disc][1] * itemNumber[disc][2];
  149.              appsTotal += appsValue;
  150.             }
  151.          }      
  152.     grandTotal = movieTotal + gameTotal + appsTotal;
  153.   }
  154.  
  155.       System.out.println("Inventory of: ");
  156.       System.out.println(Choice);
  157.       System.out.println();
  158.  
  159.  
  160.       System.out.println();
  161.       //Call to superclass methods
  162.       inventory.displayInv();
  163.       inventory.nameSort();
  164.       System.out.println();
  165.       inventory.displayInv();
  166.  
  167.       double total = inventory.totalInvCalc();
  168.       System.out.println("Total Value is: $" + total);
  169.       System.out.println();
  170.       System.out.println("The grand stock inventory value is: $");
  171.       System.out.println(grandTotal);
  172.  
  173.  
  174.  
  175.  
  176.          outputArray(itemNumber);
  177.  
  178.    }
  179.  
  180.        public static void outputArray(double itemNumber[][])
  181.     {
  182.          //Print Column headings and set spacing
  183.         System.out.printf("%5s%6s%5s%12s\n", "Disc", "Qty", "Cost", "Inv Value");
  184.         //Print values from array and set spacing between values
  185.         //set row (aka disc) and column to zero before starting
  186.         for (int disc = 0; disc < itemNumber.length; disc++)
  187.         {
  188.             for(int column = 0; column < itemNumber[disc].length; column++)
  189.  
  190.             //print information from array            
  191.             System.out.printf("%5d", itemNumber[disc][column]); 
  192.              value = 0;
  193.             //determine next value
  194.             value = itemNumber[disc][1] * itemNumber[disc][2];
  195.             grandTotal += value;
  196.             //print next value
  197.             System.out.printf("%8d",value);
  198.             //Return to start new line
  199.             //Clear values before determing next value            
  200.             System.out.println();
  201.  
  202.          }
  203.        System.out.print("The total inventory value is: $");
  204.        System.out.println(grandTotal);
  205.        System.out.println();
  206.  }
  207.    // method to sort inventory by name
  208.    public void nameSort()
  209.    {
  210.       for (int i = 1; i < stores.length; i++)
  211.       {
  212.          int j;
  213.          Product val = stores[i];
  214.          for (j = i - 1; j > -1; j--)
  215.          {
  216.             Product temp = stores[j];
  217.             if (temp.compareTo(val) <= 0)
  218.             {
  219.                break;
  220.             }
  221.             stores[j + 1] = temp;
  222.          }
  223.          stores[j + 1] = val;
  224.       }
  225.    }
  226.  
  227.    //method to create a String representation of array of class products
  228.    public String toString()
  229.    {
  230.       String s = "";
  231.       for (Product p : stores)
  232.       {
  233.          s = s + p.toString();
  234.          s = s + "\n\n";
  235.       }
  236.       return s;
  237.    }
  238.  
  239.    //method to increase array size to add products
  240.    public void addProduct(Product p1)
  241.    {
  242.       if (stores == null)
  243.       {
  244.          stores = new Product[0];
  245.       }
  246.       //Copy all products into p first
  247.       Product[] p = stores; 
  248.       //create bigger array
  249.       Product[] temp = new Product[p.length + 1]; 
  250.       //add the new product at the last position
  251.       for (int i = 0; i < p.length; i++)
  252.       {
  253.          temp[i] = p[i];
  254.       }
  255.       temp[(temp.length - 1)] = p1; 
  256.       stores = temp;
  257.    }
  258.  
  259.    //method to calculate Total Inventory Value
  260.    public double totalInvCalc()
  261.    {
  262.       double total = 0.0;
  263.       for (int i = 0; i < stores.length; i++)
  264.       {
  265.          total = total + stores[i].inventoryValue();
  266.       }
  267.       return total;
  268.    }
  269.    //method to display inventory
  270.    public void displayInv()
  271.    {
  272.       //call toString method
  273.       System.out.println(toString()); 
  274.    }
  275.  
  276.  
  277. }
  278.  
  279.  
  280. //Setup Products subclass to Main and superclass to DVD's
  281.  
  282.  
  283.  
  284. }
May 2 '07 #1
5 2506
Stephen3776
5 New Member
This part is not the problem, but here is the rest of the code:

Expand|Select|Wrap|Line Numbers
  1. class Product extends Main implements Comparable
  2. {  //Declare class variables to store item information
  3.    private String title;   
  4.    private int item;     
  5.    private double stockOnHand;   
  6.    private double cost;     
  7.    //Declare product constructor for use by subclasses and clear variables
  8.    public Product()
  9.    {
  10.       title = "";
  11.       item = 0;
  12.       stockOnHand = 0;
  13.       cost = 0.0;
  14.    }
  15.    //four argument constructor
  16.    public Product(String title, int item, double stockOnHand, double cost)
  17.    {
  18.       this.title = title;
  19.       this.item = item;
  20.       this.stockOnHand = stockOnHand;
  21.       this.cost = cost;
  22.    }
  23.    //Setup set and get methods for class Products
  24.    public void setTitle(String title)
  25.    {
  26.       this.title = title;
  27.    }
  28.  
  29.    public String getTitle()
  30.    {
  31.       return title;
  32.    }
  33.  
  34.    public void setItem(int item)
  35.    {
  36.       this.item = item;
  37.    }
  38.  
  39.    public int getItem()
  40.    {
  41.       return item;
  42.    }
  43.  
  44.    public void setstockOnHand(double quantity)
  45.    {
  46.       stockOnHand = quantity;
  47.    }
  48.  
  49.    public double getstockOnHand()
  50.    {
  51.       return stockOnHand;
  52.    }
  53.  
  54.    public void setItemcost(double cost)
  55.    {
  56.       this.cost = cost;
  57.    }
  58.  
  59.    public double getItemcost()
  60.    {
  61.       return cost;
  62.    }
  63.  
  64.    public double inventoryValue()
  65.    {
  66.       return cost * stockOnHand;
  67.    }
  68.    //implement compare method
  69.    public int compareTo(Object o)
  70.    {
  71.       Product p = null;
  72.       try
  73.       {
  74.          p = (Product) o;
  75.       }
  76.       catch (ClassCastException cE)
  77.       {
  78.          cE.printStackTrace();
  79.       }
  80.       return title.compareTo(p.getTitle());
  81.    }
  82.    //Setup method to output string overriding string in superclass 
  83.    //inventory2.Main using toString
  84.    public String toString()
  85.    {
  86.       return "Disc Title: " + title + "\nItem #: " + item + "\ncost: $" + cost + "\nQuantity: "
  87.       + stockOnHand + "\nValue: $" + inventoryValue();
  88.    }
  89. }
  90. //Setup class DVD subclass to Products
  91. class DVD extends Product
  92. {
  93.    //Declare variables for DVD subclass
  94.    private String style;
  95.    private double restockFee;
  96.  
  97.    //Five argument constructor
  98.    public DVD(String title, int item, double stockOnHand, double cost, String style)
  99.    {
  100.       super(title,item,  stockOnHand, cost);
  101.       this.style = style;
  102.       this.restockFee = 0.05;
  103.    }
  104.  
  105.    //returns the value of the inventory, plus the restocking fee
  106.    public double getInventoryValue()
  107.    {
  108.      return super.getItemcost() + restockFee;
  109.    }
  110.    //Return string with override of string of superclass inventory2.Product
  111.    //using toString
  112.    public String toString()
  113.    {
  114.       //Return string with style of DVD added
  115.       return super.toString() + "\nstyle      \t" + style;
  116.    }
  117.  
  118. }
  119. //Setup Games as subclass of Products
  120. class Games extends Product
  121. {
  122.    //Declare variables for subclass Games
  123.     private double restockFee;
  124.  
  125.    //Four argument constructor for subclass Games
  126.    public Games(String title, int item, double stockOnHand, double cost)
  127.    { 
  128.       super(title, item, stockOnHand, cost);
  129.  
  130.       this.restockFee = 0.05;
  131.    }
  132.  
  133.    //returns the value of the inventory, plus the restocking fee
  134.    public double getInventoryValue()
  135.    {
  136.     return super.getItemcost() + restockFee;
  137.    }
  138.    //Return string with override of string of superclass inventory2.Product
  139.    //using toString
  140.    public String toString()
  141.    {
  142.      return super.toString();
  143.    }
  144. }
  145. class Apps extends Product
  146. {
  147.    //Declare variables for DVD subclass
  148.    private String type;
  149.    private double restockFee;
  150.  
  151.    //Five argument constructor
  152.    public Apps(String title, int item, double stockOnHand, double cost, String type)
  153.    {
  154.       super(title,item,  stockOnHand, cost);
  155.       this.type = type;
  156.       this.restockFee = 0.05;
  157.    }
  158.  
  159.    //returns the value of the inventory, plus the restocking fee
  160.    public double getInventoryValue()
  161.    {
  162.      return super.getItemcost() + restockFee;
  163.    }
  164.    //Return string with override of string of superclass inventory2.Product
  165.    //using toString
  166.    public String toString()
  167.    {
  168.       //Return string with style of DVD added
  169.       return super.toString() + "\ntype      \t" + type;
  170.    }
May 2 '07 #2
r035198x
13,262 MVP
I am doing an inventory control progam and trying to output a multiple array, I am getting an illegal conversion error java.lang.doubl e !d. Can somebody tell me what I am doing wrong or if there is another way?

Expand|Select|Wrap|Line Numbers
  1. /*
  2. * Main.java
  3. *
  4. * Created on April 29, 2007, 6:57 PM
  5. *
  6. * To change this template, choose Tools | Template Manager
  7. * and open the template in the editor.
  8. */
  9.  
  10. package inventory2;
  11.  
  12. /**
  13. *
  14. * @author SandK
  15. */
  16. import java.util.*;
  17. import java.text.*;
  18. import java.lang.*;
  19. import javax.swing.*;
  20. import java.awt.event.*;
  21. import java.awt.*;
  22. import java.text.DecimalFormat;
  23. public class Main
  24. { //declare variables
  25. private static String Choice;
  26. private static double movieTotal;
  27. private static double movieValue;
  28. private static double gameTotal;
  29. private static double gameValue;
  30. private static double appsTotal;
  31. private static double appsValue;
  32. private double movieNumber[][];
  33. private double gameNumber[][];
  34. private double appsNumber[][];
  35. private Product[] stores;
  36. double itemNumber[][];
  37. static double value;
  38. static double grandTotal;
  39.  
  40.  
  41. public static void main(String[] args)
  42. {//set values for multiple array
  43. //assign empty set to clear final variable
  44. double itemNumber[][] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} };
  45. //assign values to Movie array 
  46. double movieNumber[][] = { {5,10,29.95}, {6,15,24.95}, {7,20,14.95},
  47. {8,20,15.95} };
  48. //assign values to Game array
  49. double gameNumber[][] = { {9,10,229.95}, {10,5,199.95}, {11,4,4999.95},
  50. {12,20,699.95} };
  51. //assign value to Apps array
  52. double appsNumber[][] = { {1,10,19.95}, {2,25,25.95}, {3,20,20.95},
  53. {4,15,19.95} }; 
  54.  
  55. Main inventory = new Main(); 
  56. {
  57. Scanner input = new Scanner (System.in);
  58. //Query user for inventory to view
  59. System.out.println("Would you like to view the movies, games, or apps inventory?");
  60. String userChoice = input.nextLine();
  61. Choice = userChoice;
  62. //Load values into array for movies selection
  63. if( userChoice.equalsIgnoreCase("movies"))
  64.  
  65. //add new DVD's to inventory 
  66. //Create subclass objects for DVD subclass including style
  67. inventory.addProduct(new DVD("White Noise", 1, 10, 19.95, "Action"));
  68. inventory.addProduct(new DVD("Jeff Foxworthy", 2, 25, 25.95, "Comedy"));
  69. inventory.addProduct(new DVD("Cars", 3, 20, 20.95, "Comedy"));
  70. inventory.addProduct(new DVD("Monster-In-Law", 4, 15, 19.95, "Comedy"));
  71. //assign multiple variable movieNumber[][] to 
  72. //itemNumber[][] for array output 
  73. for (int disc = 0; disc < itemNumber.length; disc++)
  74. {
  75. for(int column = 0; column < itemNumber[disc].length; column++)
  76. {
  77. itemNumber = movieNumber;
  78. }
  79. }
  80.  
  81. }
  82. else if (userChoice.equalsIgnoreCase("games")) 
  83. //add new games to inventory
  84. //Create subclass objects for Game subclass without style
  85. inventory.addProduct(new Games("Command and Conquer", 5, 10, 29.95 ));
  86. inventory.addProduct(new Games("Delta Force II", 6, 15, 24.95));
  87. inventory.addProduct(new Games("Roller Coaster Tycoon", 7, 20, 14.95));
  88. inventory.addProduct(new Games("Half-Life", 8, 20, 15.95));
  89. //assign multiple variable gameNumber[][] to 
  90. //itemNumber[][] for array output
  91. for (int disc = 0; disc < itemNumber.length; disc++)
  92. {
  93. for(int column = 0; column < itemNumber[disc].length; column++)
  94. {
  95. itemNumber = gameNumber;
  96. }
  97. }
  98.  
  99.  
  100. }
  101. else if (userChoice.equalsIgnoreCase("apps")) 
  102. //add new games to inventory
  103. //Create subclass objects for Game subclass with style
  104. inventory.addProduct(new Apps("Wiindows Vista 32 bit", 9, 10, 229.95,
  105. "Operating System" ));
  106. inventory.addProduct(new Apps("Windows Vista 64 bit", 10, 5, 199.95,
  107. "Operating System"));
  108. inventory.addProduct(new Apps("Autocad 2007", 11, 5, 4999.95, "Drafting"));
  109. inventory.addProduct(new Apps("Microsoft Office 2007", 12, 20, 699.95,
  110. "Business"));
  111. //assign multiple variable appsNumber[][] to 
  112. //itemNumber[][] for array output
  113. for (int disc = 0; disc < itemNumber.length; disc++)
  114. {
  115. for(int column = 0; column < itemNumber[disc].length; column++)
  116. {
  117. itemNumber = appsNumber;
  118. }
  119. }
  120. }
  121. //Determine individual totals for arrays to compute grand total
  122. //Compute movie total from array for part of grand total
  123. for (int disc = 0; disc < movieNumber.length; disc++)
  124. {
  125. for(int column = 0; column < movieNumber[disc].length; column++)
  126. {
  127. movieValue = movieNumber[disc][1] * itemNumber[disc][2];
  128. movieTotal += movieValue;
  129. }
  130. //Compute game total from array for part of grand total
  131. for (int disc = 0; disc < gameNumber.length; disc++)
  132. {
  133. for(int column = 0; column < gameNumber[disc].length; column++)
  134. {
  135. gameValue = gameNumber[disc][1] * itemNumber[disc][2]; 
  136. gameTotal += gameValue;
  137. }
  138. }
  139. //Compute apps total from array for part of grand total 
  140. for (int disc = 0; disc < appsNumber.length; disc++)
  141. {
  142. for(int column = 0; column < appsNumber[disc].length; column++)
  143. {
  144. appsValue = appsNumber[disc][1] * itemNumber[disc][2];
  145. appsTotal += appsValue;
  146. }
  147. grandTotal = movieTotal + gameTotal + appsTotal;
  148. }
  149.  
  150. System.out.println("Inventory of: ");
  151. System.out.println(Choice);
  152. System.out.println();
  153.  
  154.  
  155. System.out.println();
  156. //Call to superclass methods
  157. inventory.displayInv();
  158. inventory.nameSort();
  159. System.out.println();
  160. inventory.displayInv();
  161.  
  162. double total = inventory.totalInvCalc();
  163. System.out.println("Total Value is: $" + total);
  164. System.out.println();
  165. System.out.println("The grand stock inventory value is: $");
  166. System.out.println(grandTotal);
  167.  
  168.  
  169.  
  170.  
  171. outputArray(itemNumber);
  172.  
  173. }
  174.  
  175. public static void outputArray(double itemNumber[][])
  176. {
  177. //Print Column headings and set spacing
  178. System.out.printf("%5s%6s%5s%12s\n", "Disc", "Qty", "Cost", "Inv Value");
  179. //Print values from array and set spacing between values
  180. //set row (aka disc) and column to zero before starting
  181. for (int disc = 0; disc < itemNumber.length; disc++)
  182. {
  183. for(int column = 0; column < itemNumber[disc].length; column++)
  184.  
  185. //print information from array 
  186. System.out.printf("%5d", itemNumber[disc][column]); 
  187. value = 0;
  188. //determine next value
  189. value = itemNumber[disc][1] * itemNumber[disc][2];
  190. grandTotal += value;
  191. //print next value
  192. System.out.printf("%8d",value);
  193. //Return to start new line
  194. //Clear values before determing next value 
  195. System.out.println();
  196.  
  197. }
  198. System.out.print("The total inventory value is: $");
  199. System.out.println(grandTotal);
  200. System.out.println();
  201. }
  202. // method to sort inventory by name
  203. public void nameSort()
  204. {
  205. for (int i = 1; i < stores.length; i++)
  206. {
  207. int j;
  208. Product val = stores[i];
  209. for (j = i - 1; j > -1; j--)
  210. {
  211. Product temp = stores[j];
  212. if (temp.compareTo(val) <= 0)
  213. {
  214. break;
  215. }
  216. stores[j + 1] = temp;
  217. }
  218. stores[j + 1] = val;
  219. }
  220. }
  221.  
  222. //method to create a String representation of array of class products
  223. public String toString()
  224. {
  225. String s = "";
  226. for (Product p : stores)
  227. {
  228. s = s + p.toString();
  229. s = s + "\n\n";
  230. }
  231. return s;
  232. }
  233.  
  234. //method to increase array size to add products
  235. public void addProduct(Product p1)
  236. {
  237. if (stores == null)
  238. {
  239. stores = new Product[0];
  240. }
  241. //Copy all products into p first
  242. Product[] p = stores; 
  243. //create bigger array
  244. Product[] temp = new Product[p.length + 1]; 
  245. //add the new product at the last position
  246. for (int i = 0; i < p.length; i++)
  247. {
  248. temp[i] = p[i];
  249. }
  250. temp[(temp.length - 1)] = p1; 
  251. stores = temp;
  252. }
  253.  
  254. //method to calculate Total Inventory Value
  255. public double totalInvCalc()
  256. {
  257. double total = 0.0;
  258. for (int i = 0; i < stores.length; i++)
  259. {
  260. total = total + stores[i].inventoryValue();
  261. }
  262. return total;
  263. }
  264. //method to display inventory
  265. public void displayInv()
  266. {
  267. //call toString method
  268. System.out.println(toString()); 
  269. }
  270.  
  271.  
  272. }
  273.  
  274.  
  275. //Setup Products subclass to Main and superclass to DVD's
  276.  
  277.  
  278.  
  279. }
At which line are you getting the error?
May 2 '07 #3
Stephen3776
5 New Member
The line I am getting the error on is:

Expand|Select|Wrap|Line Numbers
  1. outputArray(itemNumber);
May 2 '07 #4
r035198x
13,262 MVP
The line I am getting the error on is:

Expand|Select|Wrap|Line Numbers
  1. outputArray(itemNumber);
Post the full error message please.
May 2 '07 #5
Stephen3776
5 New Member
Thanks for the help, glad it was so simple
May 4 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4197
by: Steve | last post by:
Hello, I need help with formatting an output of an array. I have a two dimensional array that looks something like this: x x x x y y y y b b b b ....and so on...I use to just represent the row number whereas x, y, b are some values in the array. I have no problem displaying the array on the
8
2107
by: Gactimus | last post by:
I made the program below. It outputs the smallest number in the array. What I would like to know is how do I output the array location. I am at a loss. For example, since the smallest number in the array is 2, the output should be 2 for the number and 1 for the location. If anyone could help or point me in the right direction that would be great. Thanks. ------------------- #include <iostream>
3
1312
by: Milton Snider | last post by:
I have a table of about 20 Categories. I currently have them displayed accross the page in a table from left to right in 3 columns. like this: abuse cmecf credit/etc dismissal presumptions You will notice the sort runs from left to right. I would like the sort to run vertically like this: abuse dismissal cmecf presumptions credit/etc
5
2169
by: Tom Lam lemontea | last post by:
Hi all, This is my very first post here, I've seriously tried some programming on C, and shown below is my very first program(So you can expect it to be very messy) that I wrote after I've learned the basics. However, the output function I wrote seems to repeat unneedingly for 2 times. My trial on solving it myself have failed. Anyone willing to point out where the problem lies will be greatly appreciated. Thanks. **** Source code ****
1
1054
by: menotu3169 | last post by:
Alright, I'm just learning C++ and I'm trying to make a program. It uses a 10*10 array, calculates what all the values are and then outputs the values stored in the array on the screen. My teacher's out sick, and no one in my class has been able to help me. What I want to do, is take an array of double values, and output them on the screen in a nice looking format.
9
5620
by: rkk | last post by:
Hi, I have written a generic mergesort program which is as below: --------------------------------------------------------- mergesort.h ----------------------- void MergeSort(void *array,int p,int r,int elemSize,int(*Compare)(const void *keyA,const void *keyB));
2
3560
by: rkk | last post by:
Hi, My mergesort program is below. There is a small piece of logical error/bug in this code which I can't figure out, as a result the output array isn't completely sorted. Requesting your help to resolve this problem. Thanks in advance. #include <stdlib.h> #include <string.h> #include <stdio.h>
2
1745
by: thecoolone | last post by:
I am trying to implement the yahoo search api using php. I prefer to use PHP serialized to get the result of the search displayed. Right now i get the output like: Array ( =Array ( =web =20800000
1
1285
by: LittlBUGer | last post by:
Hello. First of all I'm programming in VB.NET/ASP.NET doing a page for a website. Now, to my question.... I have a simple array of integer numbers (15 characters in length) which can hold up to 2000 items. What I basically need to do is output these numbers to a PDF file I'm creating on the fly and I can only fit a certain amount of numbers per page. What I need to do is just output these on each page in numerical order vertically NOT...
0
8801
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8707
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9174
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5947
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2110
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.