Compare commits
No commits in common. "306a492d81e61c36cae7b9dcce6700034dc63fcd" and "2821b0528b4c44c76f46e05b1cf4f2f73e2dcf6c" have entirely different histories.
306a492d81
...
2821b0528b
6 changed files with 8 additions and 127 deletions
|
|
@ -4,9 +4,8 @@
|
||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="8658cbac-7347-4046-83e8-57065c86d2b8" name="Changes" comment="Explored using 2D arrays">
|
<list default="true" id="8658cbac-7347-4046-83e8-57065c86d2b8" name="Changes" comment="updated readme to explain folder structure">
|
||||||
<change afterPath="$PROJECT_DIR$/practice_projects/src/QuizGame.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/practice_projects/src/substrings.java" beforeDir="false" afterPath="$PROJECT_DIR$/practice_projects/src/Substrings.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|
@ -65,8 +64,6 @@
|
||||||
"Application.EnhancedSwitches.executor": "Run",
|
"Application.EnhancedSwitches.executor": "Run",
|
||||||
"Application.GuessANumber.executor": "Run",
|
"Application.GuessANumber.executor": "Run",
|
||||||
"Application.Main.executor": "Run",
|
"Application.Main.executor": "Run",
|
||||||
"Application.Numpad.executor": "Run",
|
|
||||||
"Application.QuizGame.executor": "Run",
|
|
||||||
"Application.TempConverter.executor": "Run",
|
"Application.TempConverter.executor": "Run",
|
||||||
"Application.WhileLoops.executor": "Run",
|
"Application.WhileLoops.executor": "Run",
|
||||||
"Application.compountInterest.executor": "Run",
|
"Application.compountInterest.executor": "Run",
|
||||||
|
|
@ -126,7 +123,7 @@
|
||||||
<workItem from="1767678323979" duration="16130000" />
|
<workItem from="1767678323979" duration="16130000" />
|
||||||
<workItem from="1767837943314" duration="237000" />
|
<workItem from="1767837943314" duration="237000" />
|
||||||
<workItem from="1767838192168" duration="17826000" />
|
<workItem from="1767838192168" duration="17826000" />
|
||||||
<workItem from="1768158295756" duration="7326000" />
|
<workItem from="1768158295756" duration="4060000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="updated module output folders">
|
<task id="LOCAL-00001" summary="updated module output folders">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
|
|
@ -384,31 +381,7 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1768161949589</updated>
|
<updated>1768161949589</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00033" summary="updated name of class">
|
<option name="localTasksCounter" value="33" />
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1768162380069</created>
|
|
||||||
<option name="number" value="00033" />
|
|
||||||
<option name="presentableId" value="LOCAL-00033" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1768162380069</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00034" summary="capitalized class name">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1768185705755</created>
|
|
||||||
<option name="number" value="00034" />
|
|
||||||
<option name="presentableId" value="LOCAL-00034" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1768185705755</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00035" summary="Explored using 2D arrays">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1768185728116</created>
|
|
||||||
<option name="number" value="00035" />
|
|
||||||
<option name="presentableId" value="LOCAL-00035" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1768185728116</updated>
|
|
||||||
</task>
|
|
||||||
<option name="localTasksCounter" value="36" />
|
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
|
@ -426,6 +399,9 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
|
<MESSAGE value="created compound calculator" />
|
||||||
|
<MESSAGE value="fixed name of compoundInterest" />
|
||||||
|
<MESSAGE value="explored substring methods" />
|
||||||
<MESSAGE value="made a lbs to kgs weight converter" />
|
<MESSAGE value="made a lbs to kgs weight converter" />
|
||||||
<MESSAGE value="explored ternary operator" />
|
<MESSAGE value="explored ternary operator" />
|
||||||
<MESSAGE value="uploaded junk files" />
|
<MESSAGE value="uploaded junk files" />
|
||||||
|
|
@ -448,10 +424,7 @@
|
||||||
<MESSAGE value="created dice roll game. that shows all dice and total rolled" />
|
<MESSAGE value="created dice roll game. that shows all dice and total rolled" />
|
||||||
<MESSAGE value="junk java files updated" />
|
<MESSAGE value="junk java files updated" />
|
||||||
<MESSAGE value="updated readme to explain folder structure" />
|
<MESSAGE value="updated readme to explain folder structure" />
|
||||||
<MESSAGE value="updated name of class" />
|
<option name="LAST_COMMIT_MESSAGE" value="updated readme to explain folder structure" />
|
||||||
<MESSAGE value="capitalized class name" />
|
|
||||||
<MESSAGE value="Explored using 2D arrays" />
|
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Explored using 2D arrays" />
|
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,25 +0,0 @@
|
||||||
public class Numpad {
|
|
||||||
|
|
||||||
public static void main(String[] args){
|
|
||||||
// This project is to show how to use 2D Arrays
|
|
||||||
// a.k.a. Nested arrays (an array of arrays)
|
|
||||||
|
|
||||||
// 2D arrays are useful for storing a matrix of data.
|
|
||||||
|
|
||||||
|
|
||||||
// Remember - Characters are single quotes 'C'
|
|
||||||
char[][] numpad = {{'1', '2', '3'},
|
|
||||||
{'4', '5', '6'},
|
|
||||||
{'7', '8', '9'},
|
|
||||||
{'*', '0', '#'}};
|
|
||||||
|
|
||||||
// We need nested loops to print columns and rows
|
|
||||||
for(char[] row : numpad){
|
|
||||||
for(char number : row){
|
|
||||||
System.out.print(number + " ");
|
|
||||||
}
|
|
||||||
// Between every row add an empty line
|
|
||||||
System.out.println();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
public class QuizGame {
|
|
||||||
|
|
||||||
public static void main(String[] args){
|
|
||||||
|
|
||||||
Scanner scanner = new Scanner(System.in);
|
|
||||||
|
|
||||||
// This is a quiz game using 2D arrays (Nested arrays)
|
|
||||||
|
|
||||||
System.out.println("******************************");
|
|
||||||
System.out.println("Welcome to the Java Quiz Game!");
|
|
||||||
System.out.println("******************************");
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
// Variables
|
|
||||||
char[] answers = {'A', 'B', 'C', 'C', 'C'};
|
|
||||||
int score = 0;
|
|
||||||
char guess;
|
|
||||||
|
|
||||||
String[] questions = {
|
|
||||||
"What keyword is used to create a class in Java?",
|
|
||||||
"Which data type is used to store true or false values?",
|
|
||||||
"Which of the following is NOT a primitive data type in Java?",
|
|
||||||
"Which symbol is used to end a statement in Java?",
|
|
||||||
"Which keyword is used to inherit a class in Java?"
|
|
||||||
};
|
|
||||||
|
|
||||||
String[][] options = {
|
|
||||||
{"A. class", "B. new", "C. create", "D. object"},
|
|
||||||
{"A. int", "B. boolean", "C. String", "D. char"},
|
|
||||||
{"A. int", "B. double", "C. String", "D. boolean"},
|
|
||||||
{"A. :", "B. .", "C. ;", "D. ,"},
|
|
||||||
{"A. implements", "B. inherits", "C. extends", "D. super"}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < questions.length; i++){
|
|
||||||
System.out.println(questions[i]);
|
|
||||||
|
|
||||||
for(String option : options[i]){
|
|
||||||
System.out.println(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.print("Enter your guess: ");
|
|
||||||
guess = scanner.next().toUpperCase().charAt(0);
|
|
||||||
|
|
||||||
if(guess == answers[i]){
|
|
||||||
System.out.println("********");
|
|
||||||
System.out.println("CORRECT!");
|
|
||||||
System.out.println("********");
|
|
||||||
score++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
System.out.println("********");
|
|
||||||
System.out.println("WRONG!");
|
|
||||||
System.out.println("********");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Your final Score is: " + score + " out of " + questions.length);
|
|
||||||
|
|
||||||
scanner.close();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue