我正在学习编程,我想知道为什么我会出错,我不知道从哪里开始。请忽略静态无效问题_四到十和评论。我还需要有关如何改进代码的提示。感谢您的帮助,ThawingOrb。
/**
* @(#)QuizGameFinal2.java
*
*
* @author
* @version 1.00 2013/4/30
*/
import java.util.Scanner;
import java.lang.Math;
import java.lang.String;
public class QuizGameFinal2
{
public static void main(String[]args)
{
int option_Selected;
int option_Single_Player = 1;
int option_Multiplayer = 2;
int answer;
int player_One_Answer;
int player_Two_Answer;
String response;
int player_One_Winnings;
int player_Two_Winnings;
int winnings;
int computer_Winnings;
double computer_Answer;
Scanner input2 = new Scanner(System.in);
say_Intro();
say_Before_First_Question();
question_One();
human_Answer();
do
{
System.out.println("Enter a number between 1 and 3");
} while (answer < 1 && answer => 4);
if (answer == 1)
{
System.out.println("Correct Next Question");
question_Two();
human_Answer();
do
{
System.out.println("Enter a number between 1 and 4");
} while (answer < 1 && answer >= 5);
if (answer == 1 )
{
System.out.println("Correct Next Question");
question_Three();
human_Answer();
do
{
System.out.println("Enter a number between 1 and 4");
} while (answer < 1 && answer >= 5);
if (answer == 4)
{
System.out.println("Correct Next Question");
}
else
{
System.out.println("Incorrect you win 1000 dollers");
winnings = 1000;
}
}
else
{
System.out.println("Incorrect you win 500 dollers");
winnings = 500;
}
}
else
{
System.out.println("Incorrect you win 0 dollers");
winnings = 0;
}
} // End of main method
static void say_Intro() // Intro Method
{
System.out.println("Welcome to the QuizGame"); // Player selects which mode
System.out.println("Press 1 for Single Player");
System.out.println("Press 2 for Multiplayer");
Scanner input = new Scanner(System.in); // Scanner for the entire game
int option_Selected = input.nextInt();
do {
System.out.println("Please enter 1 or 2");
} while (option_Selected != 1 || option_Selected != 2);
}
public void say_Before_First_Question() // Before game method
{
System.out.println("Welcome to the quiz game.");
Scanner input = new Scanner(s);
System.out.print("Your response");
response = input.next();
System.out.println("");
System.out.println(" If you get a question wrong your out ok?");
System.out.print("Your Response:");
response = input.next();
System.out.println("Also you will be competing against a super computer, after you play then he will generate answers, if you have the most then you win");
System.out.println("Ok first question");
}
static void human_Answer () // Human Answer Single Player Method
{
int answer=input2.nextInt();
}
static void player_One_Answer() // Player One Multiplayer Method
{
int player_One_Answer = input2.nextInt();
}
static void player_Two_Answer() // Player two multiplayer Method
{
int player_Two_Answer = input2.nextInt();
}
static void computer_Answer () // Computer answer
{
double computer_Answer = (1-1 + 1) * Math.random + 1;
computer_Answer = (int)computer_Answer;
}
static void question_One() // Question 1 method
{
System.out.println("What is an application");
System.out.println("1: A program that performs a task 2:A mouse 3: java.util.Scanner");
}
static void question_Two() // Question 2 to 10 methods below
{
System.out.println("What is the data type that hold the value 1");
System.out.println("1: int 2:float 3: short 4: long ");
do
{
System.out.println("Enter a number between 1 and 4");
} while (answer < 1 && answer > 5);
}
static void question_Three()
{
System.out.println("What is a not a high level language");
System.out.println("1: Java 2:C++ 3: Colbolt 4: Machine Language ");
do
{
System.out.println("Enter a number between 1 and 3"); // Do this if the person enters a number less than one and greater than 3
} while (answer < 1 && answer > 4);
}
/* static void question_Five()
{
}
static void question_Six()
{
}
static void question_Seven()
{
}
static void question_Eight()
{
}
static void question_Nine()
{
}
static void question_Ten()
{
}
static void total_Winnings_Single_Player () // Calculating who wins method single player
{
if (computer_Winnings > winnings)
{
System.out.println("Computer Wins");
}
else
{
System.out.println("You win");
}
*/
}
// End of program