getting an error like this ")" expected in line 34
// Inventroy Class (Main Program)
public class InventoryProgram
{
public static final int MAXIMUM_ITEMS =4;
private static Product product[] = new DVD[MAXIMUM_ITEMS];
public static void main(String args[]) {
buildInventory();
getInventory();
}
// Build the inventory, storing 4 differnt products.
public static void buildInventory() {
product[1] = new DVD(1, "I am Legend" ,12, 15.99);
product[2] = new DVD(2, " Finding Nemo" ,24,10.95);
product[3] = new DVD(3, " American Ganster" ,45, 19.95);
product[4] = new DVD(4, " Finding Neverland" ,4, 17.00);
}
// Get various details of products
public static void getInventory() {
for(int i =0; i< product.length; i++) {
System.out.println("Number: " + product[i].getNumber());
System.out.println("Name: " +product[i].getName());
System.out.println("Quantity: " +product[i].getQuantity());
System.out.println("Price: " + product[i].getPrice());
System.out.println(" Item Value: " +product[i].getQuantity() * product[i].getPrice());
System.out.println( "product[i].getQuantity()) * (product[i].getPrice"());
System.out.printf("\n%s's Inventory is $%.2f\n");
System.out.println();
}
}
} // end class InventoryProgram
getting error ")" expected System.out.println( "product[i].getQuantity()) * (product[i].ge
Page 1 of 1
4 Replies - 813 Views - Last Post: 24 March 2008 - 06:54 PM
#1
getting error ")" expected
Posted 22 March 2008 - 09:38 PM
Replies To: getting error ")" expected
#2
Re: getting error ")" expected
Posted 22 March 2008 - 09:47 PM
You may want to have a look at the following line of code in your post:
Quote
System.out.println( "product[i].getQuantity()) * (product[i].getPrice"());
#3
Re: getting error ")" expected
Posted 23 March 2008 - 09:26 PM
jlewis25, on 22 Mar, 2008 - 09:38 PM, said:
getting an error like this ")" expected in line 34
thanks I looked but I can't seem to see the error,
I'm very new at this, its only my secound program project I have even tried to build.
// Inventroy Class (Main Program)
public class InventoryProgram
{
public static final int MAXIMUM_ITEMS =4;
private static Product product[] = new DVD[MAXIMUM_ITEMS];
public static void main(String args[]) {
buildInventory();
getInventory();
}
// Build the inventory, storing 4 differnt products.
public static void buildInventory() {
product[1] = new DVD(1, "I am Legend" ,12, 15.99);
product[2] = new DVD(2, " Finding Nemo" ,24,10.95);
product[3] = new DVD(3, " American Ganster" ,45, 19.95);
product[4] = new DVD(4, " Finding Neverland" ,4, 17.00);
}
// Get various details of products
public static void getInventory() {
for(int i =0; i< product.length; i++) {
System.out.println("Number: " + product[i].getNumber());
System.out.println("Name: " +product[i].getName());
System.out.println("Quantity: " +product[i].getQuantity());
System.out.println("Price: " + product[i].getPrice());
System.out.println(" Item Value: " +product[i].getQuantity() * product[i].getPrice());
System.out.println( "product[i].getQuantity()) * (product[i].getPrice"());
System.out.printf("\n%s's Inventory is $%.2f\n");
System.out.println();
}
}
} // end class InventoryProgram
#4
Re: getting error ")" expected
Posted 23 March 2008 - 09:34 PM
Modify this line:
System.out.println( "product[i].getQuantity()) * (product[i].getPrice"());
to
System.out.println( " " +product[i].getQuantity() * product[i].getPrice());
or
System.out.println( product[i].getQuantity() * product[i].getPrice());
I haven't tested it, hope it helps.
System.out.println( "product[i].getQuantity()) * (product[i].getPrice"());
to
System.out.println( " " +product[i].getQuantity() * product[i].getPrice());
or
System.out.println( product[i].getQuantity() * product[i].getPrice());
I haven't tested it, hope it helps.
This post has been edited by letthecolorsrumble: 23 March 2008 - 09:39 PM
#5
Re: getting error ")" expected
Posted 24 March 2008 - 06:54 PM
letthecolorsrumble, on 23 Mar, 2008 - 09:34 PM, said:
Modify this line:
System.out.println( "product[i].getQuantity()) * (product[i].getPrice"());
to
System.out.println( " " +product[i].getQuantity() * product[i].getPrice());
or
System.out.println( product[i].getQuantity() * product[i].getPrice());
I haven't tested it, hope it helps.
System.out.println( "product[i].getQuantity()) * (product[i].getPrice"());
to
System.out.println( " " +product[i].getQuantity() * product[i].getPrice());
or
System.out.println( product[i].getQuantity() * product[i].getPrice());
I haven't tested it, hope it helps.
thanks that seemed to work for that error, but when fixing it I relized their are a few more
will keep it posted on progress thanks again
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|