Identifier Expected
I am having trouble with this code. The error comes back with an Identifier expected.
I am not sure how to fix this.
<identifier> expected
private String int NumOfUnitsInStock;
import java.util.Scanner;
import java.text.NumberFormat;
publicclass TestDriver
{
private Inventory inventory;
private String ItemNumber;
private String ProductName;
private Stringint NumOfUnitsInStock;
public TestDriver()
{
inventory =new Inventory();
}
publicvoid acceptInput()
{
Scanner keyInput =new Scanner(System.in);
int counter = 0;
while (true)
{
if (counter > Inventory.MAX_NUM_OF_PRODUCTS)
{
break;
}
System.out.print("Enter product Name (enter stop to quit):");
String productName = keyInput.next();
if (productName.equalsIgnoreCase("STOP"))
{
return;
}
System.out.print("Enter item number:");
String itemNumber = keyInput.next();
System.out.print("Enter number of units in stock:");
String NumOfUnitsInStock = keyInput.nextInt();
while ((NumOfUnitsInStock = keyInput.nextInt()) <= 0)
{
System.out.print("Please enter a valid number:");
}
System.out.print("Enter price:");
double price;
while ((price = keyInput.nextDouble()) <= 0)
{
System.out.print("Please enter a valid number:");
}
Product product =new Product();
product.setItemNumber(itemNumber);
product.setProductName(productName);
product.setNumOfUnitsInStock(NumOfUnitsInStock);
product.setPrice(price);
inventory.addProduct(counter, product);
counter++;
}
}
publicvoid displayOutput()
{
NumberFormat moneyFormat = NumberFormat.getCurrencyInstance();
Product products[] = inventory.getSortedInventoryList();
for (int i = 0; i < inventory.getNumOfProducts(); i++)
{
Product product = products[i];
System.out.printf("Item number: %s\n", product.getItemNumber());
System.out.printf("Product Name: %s\n", product.getProductName());
System.out.printf("Number of units in stock: %d\n", product.getNumOfUnitsInStock());
System.out.printf("Price: %s\n", moneyFormat.format(product.getPrice()));
System.out.printf("Total value: %s\n", moneyFormat.format(product.getTotalValue()));
}
System.out.printf("Total Inventory value: %s\n", moneyFormat.format(inventory.getInventoryValue()));
}
staticpublicvoid main(String[] args)
{
TestDriver driver =new TestDriver();
driver.acceptInput();
driver.displayOutput();
}
}

