This is my first Java program I've ever written, so go easy on me.
Have the java.util.Scanner command...
Then the command Scanner sc = new scanner(System.in)
then I'm using different words for answers and Java bypasses every other question. However, the code words perfect if I were to answer N or n for everything.
Here's whats happening in the output window of Netbeans when answering y
First we have Cambridge Shingles
Would you like some (Y/N)y
How many would you like? 10
Next we have ArmorPlast Classic
Would you like some (Y/N)Next we have 250 Torch applied cap sheet
Would you like some (Y/N)n
Next we have 2.2mm Torch applied base sheet
Would you like some (Y/N)n
Next we have R5 Poly Iso insulation One Inch
Would you like some (Y/N)n
here's what happens when I enter N or n...
First we have Cambridge Shingles.
Would you like some (Y/N)n
Next we have ArmorPlast Classic torch applied cap sheet.
Would you like some (Y/N)n
Next we have 250 Torch applied cap sheet.
Would you like some (Y/N)n
Next we have 2.2mm Torch applied base sheet.
Would you like some (Y/N)n
Next we have R5 Poly Iso insulation One Inch.
Would you like some (Y/N)n
// Input block for products
System.out.println("First we have " + shingleName);
System.out.print("Would you like some " +"(Y/N)");
String answer = sc.nextLine();
if (answer.equals("Y") || answer.equals("y")) {
System.out.print("How many would you like? ");
int shingleUnits = sc.nextInt();
costShingleUnits = shingleUnits * shinglePrice;
} else {
costShingleUnits = 0;
}
System.out.println("Next we have " + appRoll);
System.out.print("Would you like some " +"(Y/N)");
String answerOne = sc.nextLine();
if (answerOne.equals("Y") || answerOne.equals("y")) {
System.out.print("How many would you like? ");
int appRollUnits = sc.nextInt();
costAppRoll = appRollUnits * appRollPrice;
} else {
costAppRoll = 0;
}
System.out.println("Next we have " + torchIKO);
System.out.print("Would you like some " +"(Y/N)");
String answerTwo = sc.nextLine();
if (answerTwo.equals("Y") || answerTwo.equals("y")) {
System.out.print("How many would you like? ");
int torchIKOUnits = sc.nextInt();
costTorchIKO = torchIKOUnits * torchIKOPrice;
} else {
costTorchIKO = 0;
}
System.out.println("Next we have " + torchBase);
System.out.print("Would you like some " +"(Y/N)");
String answerThree = sc.nextLine();
if (answerThree.equals("Y") || answerThree.equals("y")) {
System.out.print("How many would you like? ");
int torchBaseUnits = sc.nextInt();
costTorchBase = torchBaseUnits * torchBasePrice;
} else {
costTorchBase = 0;
}
System.out.println("Next we have " + polyISO);
System.out.print("Would you like some " +"(Y/N)");
String answerFour = sc.nextLine();
if (answerFour.equals("Y") || answerFour.equals("y")) {
System.out.print("How many would you like? ");
int polyISOUnits = sc.nextInt();
costPolyISO = polyISOUnits * polyISOPrice;
} else {
costPolyISO = 0;
}