I'm brand new to java and I have a super n00bish question. (I do have some general programming knowledge). I'm trying to access the variable "item" to no avail. Can someone spot why?
public void start()
{
Scanner input = new Scanner(System.in);
System.out.println("Enter saleman's name: ");
String name = input.next();
int exit = 0;
do
{
System.out.println("Enter item number: ");
String item = input.next();
if (ValidateItem(item) == true)
{
if (Integer.parseInt(item) <=4 && Integer.parseInt(item) >=1)\
{
exit = 1;
}
else
System.out.println("Enter an item number between 1 and 4");
}
if (ValidateItem(item) == false)
{
System.out.println("Enter an item number between 1 and 4");
}
} while (exit == 0);
int exitQuan = 0;
do
{
System.out.println("Enter quantity (1-99): ");
String quant = input.next();
if (ValidateItem(quant) == true)
{
exitQuan = 1;
}
else
System.out.println("Enter a quantity between 1 and 99");
}
while (exitQuan == 0);
if (item == 1)
{
pay = 239.99;
}
The last IF STATEMENT is where I'm lacking scope. Thanks.
do-whileblock.if(x == true). This is pointless. Writeif(x)orif(!x).