changed the file structure
This commit is contained in:
parent
cd81159162
commit
b1c3582880
391 changed files with 675 additions and 0 deletions
7
Code/Steiner/oopUebung2/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/oopUebung2/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"java.project.sourcePaths": ["src"],
|
||||
"java.project.outputPath": "bin",
|
||||
"java.project.referencedLibraries": [
|
||||
"lib/**/*.jar"
|
||||
]
|
||||
}
|
18
Code/Steiner/oopUebung2/README.md
Normal file
18
Code/Steiner/oopUebung2/README.md
Normal 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).
|
BIN
Code/Steiner/oopUebung2/bin/App.class
Normal file
BIN
Code/Steiner/oopUebung2/bin/App.class
Normal file
Binary file not shown.
BIN
Code/Steiner/oopUebung2/bin/Car.class
Normal file
BIN
Code/Steiner/oopUebung2/bin/Car.class
Normal file
Binary file not shown.
BIN
Code/Steiner/oopUebung2/bin/Price.class
Normal file
BIN
Code/Steiner/oopUebung2/bin/Price.class
Normal file
Binary file not shown.
BIN
Code/Steiner/oopUebung2/bin/Wheels.class
Normal file
BIN
Code/Steiner/oopUebung2/bin/Wheels.class
Normal file
Binary file not shown.
BIN
Code/Steiner/oopUebung2/src/App.class
Normal file
BIN
Code/Steiner/oopUebung2/src/App.class
Normal file
Binary file not shown.
57
Code/Steiner/oopUebung2/src/App.java
Normal file
57
Code/Steiner/oopUebung2/src/App.java
Normal 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("");
|
||||
}
|
||||
}
|
BIN
Code/Steiner/oopUebung2/src/Car.class
Normal file
BIN
Code/Steiner/oopUebung2/src/Car.class
Normal file
Binary file not shown.
6
Code/Steiner/oopUebung2/src/Car.java
Normal file
6
Code/Steiner/oopUebung2/src/Car.java
Normal file
|
@ -0,0 +1,6 @@
|
|||
public class Car {
|
||||
String brand;
|
||||
String name;
|
||||
Price price = new Price();
|
||||
Wheels wheel = new Wheels();
|
||||
}
|
BIN
Code/Steiner/oopUebung2/src/Price.class
Normal file
BIN
Code/Steiner/oopUebung2/src/Price.class
Normal file
Binary file not shown.
4
Code/Steiner/oopUebung2/src/Price.java
Normal file
4
Code/Steiner/oopUebung2/src/Price.java
Normal file
|
@ -0,0 +1,4 @@
|
|||
public class Price {
|
||||
int price;
|
||||
String currency;
|
||||
}
|
BIN
Code/Steiner/oopUebung2/src/Wheels.class
Normal file
BIN
Code/Steiner/oopUebung2/src/Wheels.class
Normal file
Binary file not shown.
5
Code/Steiner/oopUebung2/src/Wheels.java
Normal file
5
Code/Steiner/oopUebung2/src/Wheels.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
public class Wheels {
|
||||
int numberOfWheels;
|
||||
int zoll;
|
||||
double bar;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue