누구든지 카운터 값을 증가시킨 후 전송하는 방법을 알고 있습니까? 그래서 만약 당신이 그것을 바로 다음 방법에 하나 변경?다른 방법으로 데이터를 가져 오는 방법은 무엇입니까?
package swag;
import java.util.Scanner;
public class Main {
public static void enter(){
System.out.print("welcome to the impossibe game! Press enter to start.");
Scanner input = new Scanner(System.in);
String enter = input.nextLine();
if (enter.equals("")){
System.out.println(" Level one");
}else{
System.out.println("Please press enter");
}
}
public static void firstlevel(){
System.out.println("What is the tenth digit of PI?");
Scanner input = new Scanner(System.in);
int awnser = input.nextInt();
int awnser1 = 5;
int counter = 0;
if (awnser == awnser1){
System.out.println("Correct!");
counter++;
System.out.println(" Score: " +counter + "/1");
}else{
System.out.println("Wrong!");
System.out.println(" Score:"+ counter+"/1");
}
}
public static void secondlevel(){
System.out.println("a king and queen get on a boat. then the boat sinks. how many people are alive");
Scanner input = new Scanner(System.in);
String awnser = input.nextLine();
if (awnser.equals("two ")){
System.out.println(" Correct!");
}
}
public static void main(String args[]){
enter();
firstlevel();
}
}
보고하시기 바랍니다 게시, 그것이 틀린 것처럼 보입니다. "질문하는 방법"페이지는 게시물을 게시하기 전에 귀하의 게시물을 읽도록 알려줍니다. 그것은 낄낄 거림을위한 것이 아니라 사람들이 실제로 당신의 게시물을 읽을 수 있어야합니다 =) –