+ 1
What is wrong in this? I see that trouble is about using Scanner library,but don't understand what exactly
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner price1 = new Scanner(System.in); Scanner price2 = new Scanner(System.in); int price12= price1.nextInt(); int price22 = price2.nextInt(); int newPrice=price12*2/100; if(newPrice<price22){ System.out.print("Pesos"); } else{ System.out.print("Dollars"); } } }
1 Answer
+ 5
You should open und use only one scanner for all inputs.