嘿,我在学校上编程课,但老师没有很好地解释,所以我们必须在网上寻找我所做的信息,但我无法在我的代码中找到错误,你能帮我吗?
char end='s';
do{
System.out.println("Tipo de boleto");
char boleto = (char) System.in.read();
switch (boleto){
case 'a':
System.out.println("El boleto cuesta $120.00");
System.out.println("Otro boleto (s/n)?");
end = (char) Integer.parseInt(entrada.readLine());
continue;
case 'n':
System.out.println("El boleto cuesta $75.00");
System.out.println("Otro boleto (s/n)?");
end = (char) Integer.parseInt(entrada.readLine());
continue;
case 'i':
System.out.println("El boleto cuesta $60.00");
System.out.println("Otro boleto (s/n)?");
end = (char) Integer.parseInt(entrada.readLine());;
continue;
default:
System.out.println("Error" );
break;
}
}
while (end == 'n');
Run Code Online (Sandbox Code Playgroud)
例外
run: Tipo de boleto a El boleto cuesta $120.00 Otro boleto (s/n)?
Exception …Run Code Online (Sandbox Code Playgroud)