Compare commits

..

No commits in common. "92a33e4499ae61eeb758cb0f8524782f1e90b043" and "907e8c096ebefcd074e8b1d726cf2a7fdd50d85c" have entirely different histories.

6 changed files with 10 additions and 235 deletions

View file

@ -4,11 +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="updated java junk files"> <list default="true" id="8658cbac-7347-4046-83e8-57065c86d2b8" name="Changes" comment="java class file update">
<change afterPath="$PROJECT_DIR$/practice_projects/src/Banking.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/practice_projects/src/GuessANumber.java" beforeDir="false" afterPath="$PROJECT_DIR$/practice_projects/src/GuessANumber.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/practice_projects/src/Dice.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/java_practice/GuessANumber.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/java_practice/GuessANumber.class" 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" />
@ -37,10 +34,10 @@
&quot;accountId&quot;: &quot;1865e200-c7ac-4f58-baed-f72f06b5746c&quot; &quot;accountId&quot;: &quot;1865e200-c7ac-4f58-baed-f72f06b5746c&quot;
} }
}</component> }</component>
<component name="KubernetesApiPersistence">{}</component> <component name="KubernetesApiPersistence"><![CDATA[{}]]></component>
<component name="KubernetesApiProvider">{ <component name="KubernetesApiProvider"><![CDATA[{
&quot;isMigrated&quot;: true "isMigrated": true
}</component> }]]></component>
<component name="McpProjectServerCommands"> <component name="McpProjectServerCommands">
<commands /> <commands />
<urls /> <urls />
@ -61,9 +58,7 @@
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent"><![CDATA[{
"keyToString": { "keyToString": {
"Application.Banking.executor": "Run",
"Application.Calculator.executor": "Run", "Application.Calculator.executor": "Run",
"Application.Dice.executor": "Run",
"Application.EnhancedSwitches.executor": "Run", "Application.EnhancedSwitches.executor": "Run",
"Application.GuessANumber.executor": "Run", "Application.GuessANumber.executor": "Run",
"Application.Main.executor": "Run", "Application.Main.executor": "Run",
@ -97,7 +92,7 @@
"project.structure.last.edited": "SDKs", "project.structure.last.edited": "SDKs",
"project.structure.proportion": "0.15", "project.structure.proportion": "0.15",
"project.structure.side.proportion": "0.2", "project.structure.side.proportion": "0.2",
"settings.editor.selected.configurable": "editing.templates", "settings.editor.selected.configurable": "configurable.group.language",
"to.speed.mode.migration.done": "true", "to.speed.mode.migration.done": "true",
"vue.rearranger.settings.migration": "true" "vue.rearranger.settings.migration": "true"
} }
@ -125,8 +120,7 @@
<workItem from="1767557093354" duration="14440000" /> <workItem from="1767557093354" duration="14440000" />
<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="8317000" />
<workItem from="1768158295756" duration="2394000" />
</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" />
@ -320,23 +314,7 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1767855617721</updated> <updated>1767855617721</updated>
</task> </task>
<task id="LOCAL-00025" summary="added notes to explain IF statement"> <option name="localTasksCounter" value="25" />
<option name="closed" value="true" />
<created>1767855849671</created>
<option name="number" value="00025" />
<option name="presentableId" value="LOCAL-00025" />
<option name="project" value="LOCAL" />
<updated>1767855849671</updated>
</task>
<task id="LOCAL-00026" summary="updated java junk files">
<option name="closed" value="true" />
<created>1767855859506</created>
<option name="number" value="00026" />
<option name="presentableId" value="LOCAL-00026" />
<option name="project" value="LOCAL" />
<updated>1767855859506</updated>
</task>
<option name="localTasksCounter" value="27" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -376,9 +354,7 @@
<MESSAGE value="made a basic calculator" /> <MESSAGE value="made a basic calculator" />
<MESSAGE value="coded a Random number Guessing game" /> <MESSAGE value="coded a Random number Guessing game" />
<MESSAGE value="java class file update" /> <MESSAGE value="java class file update" />
<MESSAGE value="added notes to explain IF statement" /> <option name="LAST_COMMIT_MESSAGE" value="java class file update" />
<MESSAGE value="updated java junk files" />
<option name="LAST_COMMIT_MESSAGE" value="updated java junk files" />
</component> </component>
<component name="XSLT-Support.FileAssociations.UIState"> <component name="XSLT-Support.FileAssociations.UIState">
<expand /> <expand />

View file

@ -1,77 +0,0 @@
import java.util.Scanner;
public class Banking {
static Scanner scanner = new Scanner(System.in);
public static void main(String[] args){
double balance = 0.00;
boolean isRunning = true;
while(isRunning) {
System.out.println("");
System.out.println("***************");
System.out.println("BANKING PROGRAM");
System.out.println("***************");
System.out.println("1. Show Balance");
System.out.println("2. Deposit");
System.out.println("3. Withdraw");
System.out.println("4. Exit");
System.out.println("***************");
System.out.print("Enter your choice (1-4): ");
int choice = scanner.nextInt();
switch (choice) {
case 1 -> balance(balance);
case 2 -> balance += deposit();
case 3 -> balance -= withdraw(balance);
case 4 -> isRunning = false;
default -> System.out.println("Invalid choice");
}
}
System.out.println("***************");
System.out.println("Have a nice day!");
System.out.println("***************");
scanner.close();
}
static void balance(double balance){
System.out.println("***************");
System.out.printf("$%.2f\n", balance);
}
static double deposit(){
System.out.print("Enter amount to deposit: ");
double amount = scanner.nextDouble();
if(amount < 0){
System.out.println("Amount can't be negative! ");
return 0;
} else {
return amount;
}
}
static double withdraw(double balance){
System.out.print("Enter amount to withdraw: ");
double amount = scanner.nextDouble();
if(amount < 0){
System.out.println("Amount can't be negative! ");
return 0;
} else if (amount > balance){
System.out.println("INSUFFICIENT FUNDS!");
return 0;
} else {
return amount;
}
}
}

View file

@ -1,124 +0,0 @@
import java.util.Scanner;
import java.util.Random;
public class Dice {
static Random random = new Random();
// JAVA DICE ROLLER PROGRAM
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int numOfDice;
int total;
System.out.println("**************************");
System.out.println("WELCOME TO THE DICE ROLLER");
System.out.println("**************************");
System.out.println("Enter the # of dice to roll: ");
numOfDice = scanner.nextInt();
if(numOfDice <= 0){
System.out.print("# of dice must be more than 0!");
} else {
int[] rolls = rollDice(numOfDice);
total = calcTotal(rolls);
printTotal(total);
}
scanner.close();
}
static int[] rollDice(int numOfDice){
int[] rolls = new int[numOfDice];
for(int i = 0; i < numOfDice; i++){
int roll = random.nextInt(1, 7);
rolls[i] = roll;
printDie(roll);
System.out.println("You rolled: " + roll);
}
return rolls;
}
static int calcTotal(int[] rolls){
int total = 0;
System.out.print("\nDice rolled: ");
for(int roll : rolls){
System.out.print("[ " + roll + " ]");
total+= roll;
}
return total;
}
static void printDie(int roll){
String dice1 = """
-------
| |
| |
| |
-------
""";
String dice2 = """
-------
| |
| |
| |
-------
""";
String dice3 = """
-------
| |
| |
| |
-------
""";
String dice4 = """
-------
| |
| |
| |
-------
""";
String dice5 = """
-------
| |
| |
| |
-------
""";
String dice6 = """
-------
| |
| |
| |
-------
""";
switch (roll) {
case 1 -> System.out.print(dice1);
case 2 -> System.out.print(dice2);
case 3 -> System.out.print(dice3);
case 4 -> System.out.print(dice4);
case 5 -> System.out.print(dice5);
case 6 -> System.out.print(dice6);
default -> System.out.print("Invalid roll");
}
}
static void printTotal(int total){
System.out.println("\nTotal: " + total);
}
}