The following program is to be used to call up a class that tests for the barcode length and integrity, I am having problems compiling it as when it gets to the p = new Product etc it cannot resolve the symbol p can anyone help me to get this to work
/** * This is a program to Enter and check product codes and prices * and give a summary of values at the end * @author (Jeffrey Jones) * @version (version 2 5th April 2003) */ public class ProcessProduct { public static void main(String args[]) {
StaticProduct Product = new StaticProduct(); //declare variables
String manuf; String name; int sLength; String p; String barcode; int price; int quantity; int totalPrice=0; int transactions=1; int totalQuantity=0; int totalValue=0; int averageCost=0;
//start of while loop checking for 0 to exit loop while (!manuf.equals("0")) { System.out.print("Enter Product Name : "); name = UserInput.readString();
System.out.print("Enter Bar Code : "); barcode = UserInput.readString();
//check for invalid data
if (StaticProduct.isValidBarcode(barcode))
{barcode = new code(); p = new Product("manuf","name","quantity","price"); }//closing bracket of if
else {//error handling }//closing bracket of if
//check for quantity input and errors System.out.print("Enter Quantity : "); quantity = UserInput.readInt();
if (quantity<=0) { System.out.print(" Error, invalid value "); System.exit(0); }// check for invalid entries
//check for price input and errors if (price<=0) { System.out.print(" Error, invalid value "); }// check for invalid entries
//total price value totalPrice=price*quantity;
//Output of correctly inputted data System.out.println(manuf+":"+name+":"+barcode+":"+price); System.out.println(quantity+" @ "+price+" = "+totalPrice);
//update variables quantities //update total quantity totalQuantity = (totalQuantity + quantity); //keep count of total value totalValue = (totalValue + totalPrice); //keep count of totqal no of transactions transactions = (transactions++);