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();

}

}

[4731 byte] By [4zlimita] at [2007-11-27 8:30:13]
# 1
private String int NumOfUnitsInStock;you declared your NumOfUnitsInStock variable both as a String and an int.
lem@phila at 2007-7-12 20:20:45 > top of Java-index,Java Essentials,New To Java...
# 2
Thank you.
4zlimita at 2007-7-12 20:20:45 > top of Java-index,Java Essentials,New To Java...
# 3
Be honest, that was extremely obvious wasn't it. If you just took a moment, looked at your code and thought about it, you could have worked it out yourself.
floundera at 2007-7-12 20:20:45 > top of Java-index,Java Essentials,New To Java...
# 4
> Be honest, that was extremely obvious wasn't it. If> you just took a moment, looked at your code and> thought about it, you could have worked it out> yourself.Lol heheh Master is hyped up tonite
lrngjavaa at 2007-7-12 20:20:45 > top of Java-index,Java Essentials,New To Java...
# 5
ROFL @ the erroreven if u didjavac TestDriver.java it would come up with the error and tell u excatly where it is:)
monk3ya at 2007-7-12 20:20:45 > top of Java-index,Java Essentials,New To Java...
# 6

> Be honest, that was extremely obvious wasn't it. If

> you just took a moment, looked at your code and

> thought about it, you could have worked it out

> yourself.

I am not sure what it is about you flounder that makes you such a misereable douche bag. Helping is not up your alley at all. You sit and browse through the forum with such a snotty attidue you reek of it. People, me included, come here because we are lost trying to figure out java. I am sure that there are things that you are not good at. Learning by reaching out for help is not a horrible thing. I have not been lazy in my posts. I get stuck on a certain issue. If it is obvious to you, then so be it. Week 5 in java is not a position for anyone to be a mastermind. Sometimes the most obvious is the hardest to find.

I hope that one day you won't need help from someone.

4zlimita at 2007-7-12 20:20:45 > top of Java-index,Java Essentials,New To Java...