First I apologizeif the answer to my question is somewhere in the hundreds of posts listed. I am new to java and basically clueless. I am suppose to pass an array to a method and then sort the array. I get an "illegal start of expression error when attempting to compile the code. Can/will someone please help? Here is my code:
import java.util.*;
import java.io.*;
public class Inventory
{
public static void main(String args[])throws IOException
{
String invArray[] = {"BDVD", "HDVD", "Music", "1220", "1367", "2903", "15", "25", "18", "19.95", "15.79", "13.99"};
double totInventory1;
double totInventory2;
double totInventory3;
double totalInventory;
totInventory1 = 0;
totInventory2 = 0;
totInventory3 = 0;
totalInventory = 0;
String productName1 = invArray[0];
int productNumber1 = Integer.parseInt(invArray[3]);
int inStock1 = Integer.parseInt(invArray[6]);
double unitPrice1 = Double.valueOf(invArray[9].trim()).doubleValue();
String productName2 = invArray[1];
int productNumber2 = Integer.parseInt(invArray[4]);
int inStock2 = Integer.parseInt(invArray[7]);
double unitPrice2 = Double.valueOf(invArray[10].trim()).doubleValue();
String productName3 = invArray[2];
int productNumber3 = Integer.parseInt(invArray[5]);
int inStock3 = Integer.parseInt(invArray[8]);
double unitPrice3 = Double.valueOf(invArray[11].trim()).doubleValue();
totInventory1 = (inStock1 * unitPrice1);
totInventory2 = (inStock2 * unitPrice2);
totInventory3 = (inStock3 * unitPrice3);
Product prod = new Product(totInventory1, totInventory2, totInventory3);
totalInventory = prod.gettInventory();
//Method Sort Array
modifyArray(invArray);
{
System.out.printf( "%2s%s%13s%16s%12s%12s%16s\n", " ", "Item Name",
"Item Number", "Items on Hand", "Item Price", "Item Value", "Total Value");
int counter =0;
System.out.printf( "%d%8s%10d%16d%16.2f%12.2f\n", (counter +1), productName1,
productNumber1, inStock1, unitPrice1, totInventory1);
System.out.printf( "%d%8s%10d%16d%16.2f%12.2f\n", (counter +2), productName2,
productNumber2, inStock2, unitPrice2, totInventory2);
System.out.printf( "%d%8s%10d%16d%16.2f%12.2f\n", (counter +3), productName3,
productNumber3, inStock3, unitPrice3, totInventory3);
System.out.println();
System.out.printf("%70s$%.2f\n", "Value of total inventory: ", totalInventory);
public static void modifyArray( String invArray2 [] )
//void modifyArray( String b [] )
{
Arrays.sort(invArray2);
}
}