added old projects

This commit is contained in:
Austin Bennett
2026-02-03 08:18:39 -06:00
parent 43acf989bf
commit 2451448b8a
623 changed files with 28117 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin"
}
+18
View File
@@ -0,0 +1,18 @@
## Getting Started
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
## Folder Structure
The workspace contains two folders by default, where:
- `src`: the folder to maintain sources
- `lib`: the folder to maintain dependencies
Meanwhile, the compiled output files will be generated in the `bin` folder by default.
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
## Dependency Management
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
Binary file not shown.
Binary file not shown.
Binary file not shown.
+37
View File
@@ -0,0 +1,37 @@
import java.util.Random;
public class Die {
private int _sides = 6;
private int _roll;
public int roll() {
Random rnd = new Random();
_roll = rnd.nextInt(_sides) + 1;
return _roll;
}
public int getRoll() {
return _roll;
}
public String toString() {
switch (_roll) {
case 1:
return "One";
case 2:
return "Two";
case 3:
return "Three";
case 4:
return "Four";
case 5:
return "Five";
case 6:
return "Six";
default:
return "roll the dice";
}
}
}
+22
View File
@@ -0,0 +1,22 @@
public class PairOfDice {
Die die1 = new Die();
Die die2 = new Die(3);
int _sides;
public void PairOfDice() {
_sides = 6;
}
public void PairOfDice(int sides) {
_sides = sides;
}
public void roll() {
die1.roll();
die2.roll();
}
public int getRoll() {
return die1.getRoll() + die2.getRoll();
}
}
+20
View File
@@ -0,0 +1,20 @@
public class Player {
public static void main(String[] args) throws Exception {
Die die1 = new Die();
Die die2 = new Die();
PairOfDice pod1 = new PairOfDice();
PairOfDice pod2 = new PairOfDice();
die1.roll();
System.out.println("1 Die: " + die1.toString());
die2.roll();
System.out.println("1 Die: " + die2.toString());
pod1.roll();
pod2.roll();
System.out.println("2 Dice: " + pod1.getRoll());
System.out.println("2 Dice: " + pod2.getRoll());
}
}