changed the file structure

This commit is contained in:
Sage The DM 2024-08-27 10:41:17 +02:00
parent cd81159162
commit b1c3582880
391 changed files with 675 additions and 0 deletions

View file

@ -0,0 +1,7 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}

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).

View file

@ -0,0 +1,69 @@
// Variables
int minRange = 0;
int maxRange = 1000;
int sum = 0;
int smallNumber = 0;
int bigNumber = 0;
boolean math = false;
System.out.println("For random numbers, select 1, to define numbers press 2, to cancel press 3");
int userInput = scan.nextInt();
switch (userInput) {
case 1:
// Generate two random numbers
math = true;
int random1 = random.nextInt(maxRange - minRange + 1) + minRange;
int random2 = random.nextInt(maxRange - minRange + 1) + minRange;
System.out.println("Random number 1: " + random1);
System.out.println("Random number 2: " + random2);
// Calculate the sum of random numbers
for (int i = Math.min(random1, random2); i <= Math.max(random1, random2); i++) {
sum += i;
}
if (random1 > random2) {
bigNumber = random1;
smallNumber = random2;
} else {
bigNumber = random2;
smallNumber = random1;
}
break;
case 2:
math = true;
System.out.println("Enter the first number: ");
int numberOne = scan.nextInt();
System.out.println("Enter the second number: ");
int numberTwo = scan.nextInt();
if (numberOne > numberTwo) {
bigNumber = numberOne;
smallNumber = numberTwo;
} else {
bigNumber = numberTwo;
smallNumber = numberOne;
}
for (int i = smallNumber; i <= bigNumber; i++) {
sum += i;
}
break;
case 3:
System.out.println("Cancelled");
break;
default:
System.out.println("Invalid choice");
break;
}
if (math) {
System.out.println("Sum of numbers between " + smallNumber + " and " + bigNumber + " is: " + sum);
}
scan.close();
}
}