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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,57 @@
public class App {
public static void main(String[] args) {
// Define vehicles as a 2D array of objects
Object[][] vehicles = {
{ "Tesla", "Model S", 79999, "USD", 4, 19, 2.1 },
{ "BMW", "i8", 147500, "USD", 4, 20, 1.8 },
{ "Ducati", "Panigale V4", 21995, "USD", 2, 17, 3.2 },
{ "Ford", "Mustang GT", 55995, "USD", 4, 20, 2.5 },
{ "Audi", "A4", 39900, "USD", 4, 18, 2.0 },
{ "Harley-Davidson", "Street 750", 7499, "USD", 2, 17, 2.5 },
{ "Mercedes-Benz", "S-Class", 109900, "USD", 4, 19, 2.3 },
{ "Honda", "Civic Type R", 37995, "USD", 4, 20, 2.2 },
{ "Kawasaki", "Ninja ZX-10R", 16799, "USD", 2, 17, 2.8 },
{ "Chevrolet", "Corvette Stingray", 65995, "USD", 4, 20, 2.6 },
{ "Porsche", "911 Carrera", 99900, "USD", 4, 20, 2.4 },
{ "Toyota", "Land Cruiser", 85995, "USD", 4, 18, 2.7 },
{ "BMW", "M3", 71900, "USD", 4, 19, 2.1 },
{ "Harley-Davidson", "XLH Sportster 1200", 9995, "USD", 2, 16, 2.8 }
};
// Create an array to hold Car objects
Car[] myCars = new Car[vehicles.length];
// Create and store Car objects in the array
for (int i = 0; i < vehicles.length; i++) {
myCars[i] = createCar(vehicles[i]);
}
// Print out the details of each Car
for (Car car : myCars) {
printCar(car);
}
}
private static Car createCar(Object[] vehicle) {
Car car = new Car();
car.brand = (String) vehicle[0];
car.name = (String) vehicle[1];
car.price.price = (int) vehicle[2];
car.price.currency = (String) vehicle[3];
car.wheel.numberOfWheels = (int) vehicle[4];
car.wheel.zoll = (int) vehicle[5];
car.wheel.bar = (double) vehicle[6];
return car;
}
private static void printCar(Car car) {
System.out.println("Brand: " + car.brand);
System.out.println("Name: " + car.name);
System.out.println("Price: " + car.price.price + " " + car.price.currency);
System.out.println("Wheels: " + car.wheel.numberOfWheels);
System.out.println("Zoll: " + car.wheel.zoll);
System.out.println("Bar: " + car.wheel.bar);
System.out.println("");
}
}

Binary file not shown.

View file

@ -0,0 +1,6 @@
public class Car {
String brand;
String name;
Price price = new Price();
Wheels wheel = new Wheels();
}

Binary file not shown.

View file

@ -0,0 +1,4 @@
public class Price {
int price;
String currency;
}

Binary file not shown.

View file

@ -0,0 +1,5 @@
public class Wheels {
int numberOfWheels;
int zoll;
double bar;
}