Skip to content
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions learning-java-2825378.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
32 changes: 32 additions & 0 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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 correctAnswer = 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(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);
}
}

}