diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..e7e9d11d --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 00000000..dd2f277f --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +LearningJava \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..5217e29a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..b6f11837 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/learning-java-2825378.iml b/learning-java-2825378.iml new file mode 100644 index 00000000..c90834f2 --- /dev/null +++ b/learning-java-2825378.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/out/production/learning-java-2825378/Main.class b/out/production/learning-java-2825378/Main.class new file mode 100644 index 00000000..492d9112 Binary files /dev/null and b/out/production/learning-java-2825378/Main.class differ diff --git a/src/Main.java b/src/Main.java new file mode 100644 index 00000000..3d1b3c70 --- /dev/null +++ b/src/Main.java @@ -0,0 +1,37 @@ +import java.util.Scanner; + +public class Main { + + public static void main(String args[]) { + String question = "What is the largest planet in our solar system?"; + String choiceOne = "earth"; + String choiceTwo = "jupiter"; + String choiceThree = "saturn"; + + String correctAnswe = choiceThree; + + // Write a print statement asking the question + System.out.println(question); + + // Write a print statement giving the answer choices + System.out.println("Choose one of the following: " + + choiceOne + ", " + choiceTwo + ", or " + choiceThree + ".") + + // Have the user input an answer + Scanner scanner = new Scanner(System.in); + // Retrieve the user's input + String input = scanner.next(); + + // If the user's input matches the correctAnswer... + // then the user is correct and we want to print out a congrats message to the user. + if(correctAnswer.equals(input.toLowerCase())) { + System.out.println("Congrats! That's the correct answer"); + } else { + System.out.println("You are incorrect. The correct answer is " + correctAnswer); + } + // If the user's input does not match the correctAnswer... + // then the user is incorrect and we want to print out a message saying that the user is incorrect as well as what the correct choice was. + + } + +}