import java.util.Scanner;// Import and use scanner
import java.util.Arrays;
public class Inventory3 {
//begins execution of program
public static void main(String[] args) {
//create new object
CD mycd = new CD();
//create and intialize array of CDs
CD[] cdArray = new CD[3];
cdArray[0] = new CD("Rolling Stones",100,25,14.99);
cdArray[1] = new CD("Pearl Jam",101,18,12.99);
cdArray[2] = new CD("Journey",102,11,15.99);
for(int i=0; i < cdArray.length; i++)
{
System.out.println("\nCategory, Unit, and Price Information\n" + cdArray[i].toString());
cdArray[i].showInventory();
}
//sorting items
private static void sortArray; {
Arrays.sort( cdArray, new productComparator());
} // end method
double total = 0;
sortArray();
for (int item =0; item < cdArray.length; item ++) {
System.out.println("Category is " + cdArray[item].getName());
System.out.println("The number of units in stock is " + cdArray[item].getitems());
System.out.println("The price of each CD is $" + cdArray[item].getprice());
System.out.println("The item number is " + cdArray[item].getitemNum());
System.out.println("The value of inventory is $" + cdArray[item].getvalue());
total=total+cdArray[item].getvalue();
}
// display the value of entire inventory
System.out.println( "Total inventory value is: $%.2f", total );
//sorting items
private static void sortArray; {
Arrays.sort( cdArray, new ProductComparator());
} // end method
} //end main
} // end class Inventory
I am new to the daniweb site, so please bare with me. I already have compiled correctly the "CD class" and another class calcuating a re-stocking fee. I am having an issue getting this array to work work properly and display properly. There is no GUI needed.. I obviously am doing something wrong and could use some guidance please!