This is my code, here when i input the Product name i.e. Laptop/Mobile and then input the price. after that the program does not input eask and simply goes to the eask if-else case and prints the Invalid option as:
import java.util.*;
class Main {
public static void main(String[] args) {
int discount=0,ediscount=1;
Scanner sc = new Scanner(System.in);
String Product = sc.nextLine();
int Price = sc.nextInt();
String eask = sc.nextLine();
if(Price>100){
if(eask == "Yes" || eask == "No"){
if(Product == "Mobile"){
discount = 10;
if(eask == "Yes")
ediscount=12;
}
else if(Product == "Laptop"){
discount = 20;
if(eask == "Yes")
ediscount=10;
}
else if(Product == "gadgets"){
discount = 0;
if(eask == "Yes")
ediscount=0;
}
else System.out.println("Invalid product");
}
else
System.out.println("Invalid option");
}
else System.out.println("Invalid price");
float TBA = discount * Price;
System.out.println(TBA);
}
}