i have a small program im working on for school could some one please help me and tell me were im goin wrong??
public class Assignment2
public static void main (String  args)
Scanner input = new Scanner (System.in);
double product1 = 2.98;
double product2 = 4.50;
double product3 = 9.98;
double product4 = 4.49;
double product5 = 6.87;
// create loop
productCount = 0;
while (productCount < 6)
System.out.println("enter quantity for product1");
quanityproduct1 = Console.readInt();
System.out.println("enter quantity for product 2");
quanityproduct2 = Console.readInt();
System.out.println("enter quantity for product 3");
quanityproduct3 = Console.readInt();
System.out.println("enter quantity for product 4");
quanityproduct4 = Console.readInt();
System.out.println("enter quanity for product 5");
quanityproduct5 = Console.readInt();
productCount = productCount + 1;}
totalproduct1 = quanityproduct1 * product1;
totalproduct1 = quanityproduct2 * product2;
totalproduct1 = quanityproduct3 * product3;
totalproduct1 = quanityproduct4 * product4;
totalproduct1 = quanityproduct5 * product5;
total = totalproduct1 + totalproduct2 + totalproduct3 + totalproduct4 + totalproduct5;
System.out.println("total for all products is " + total);
im getting errors at all the "quanityproduct1 = Console.readInt();" the error is "cnnot find symbol". I dont know wot it is as far as i can tell the code should work,iv been told i could use arrays but im still very new and not quite that far,anyway any help would be great
you should post the exact errors you get from the java if you want insight on them.
You defined your scanner as input, not Console.
Try using input.readInt();
still get them same errors,
You also have to initialize your quantityproducts... And make sure that your scanner is input.nextInt(),
Also please post your errors...
doh, I should have cought that.
Originally Posted by markw8500
i dont know..
just enter to c..huhuh