AHHHHHHHHHH COMMITED TO GITHUB INSTEAD OF FORGEJO FOR WEEKS
This commit is contained in:
parent
d6ef44f3d1
commit
0919005cb2
163 changed files with 3875 additions and 47 deletions
7
Code/Steiner/dynamicCasting/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/dynamicCasting/.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/dynamicCasting/README.md
Normal file
18
Code/Steiner/dynamicCasting/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/dynamicCasting/bin/App.class
Normal file
BIN
Code/Steiner/dynamicCasting/bin/App.class
Normal file
Binary file not shown.
BIN
Code/Steiner/dynamicCasting/bin/Article.class
Normal file
BIN
Code/Steiner/dynamicCasting/bin/Article.class
Normal file
Binary file not shown.
BIN
Code/Steiner/dynamicCasting/bin/Audio.class
Normal file
BIN
Code/Steiner/dynamicCasting/bin/Audio.class
Normal file
Binary file not shown.
BIN
Code/Steiner/dynamicCasting/bin/Book.class
Normal file
BIN
Code/Steiner/dynamicCasting/bin/Book.class
Normal file
Binary file not shown.
BIN
Code/Steiner/dynamicCasting/bin/CD.class
Normal file
BIN
Code/Steiner/dynamicCasting/bin/CD.class
Normal file
Binary file not shown.
BIN
Code/Steiner/dynamicCasting/bin/Camera.class
Normal file
BIN
Code/Steiner/dynamicCasting/bin/Camera.class
Normal file
Binary file not shown.
BIN
Code/Steiner/dynamicCasting/bin/MP3.class
Normal file
BIN
Code/Steiner/dynamicCasting/bin/MP3.class
Normal file
Binary file not shown.
21
Code/Steiner/dynamicCasting/src/App.java
Normal file
21
Code/Steiner/dynamicCasting/src/App.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class App {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ArrayList<Article> list = new ArrayList<Article>();
|
||||
list.add(new Book("11241", 12, "Tolkien", "The Book to rule all books"));
|
||||
list.add(new Camera("0101012", 25000, "Fujifilm"));
|
||||
list.add(new CD("0345678", 56789, "hello",
|
||||
new ArrayList<String>(Arrays.asList("Hello", "World", "THIS IS THE END"))));
|
||||
list.add(new MP3("RASPUTIN", 456789, "Rasputin", "lengh"));
|
||||
|
||||
for (Article article : list) {
|
||||
article.print();
|
||||
if (article instanceof CD) {
|
||||
((CD) article).playTrack();
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
16
Code/Steiner/dynamicCasting/src/Article.java
Normal file
16
Code/Steiner/dynamicCasting/src/Article.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
public abstract class Article {
|
||||
String code;
|
||||
double price;
|
||||
|
||||
public Article(String code, double price) {
|
||||
this.code = code;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
boolean available() {
|
||||
boolean maybe = true;
|
||||
return maybe;
|
||||
}
|
||||
|
||||
abstract void print();
|
||||
}
|
11
Code/Steiner/dynamicCasting/src/Audio.java
Normal file
11
Code/Steiner/dynamicCasting/src/Audio.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
public abstract class Audio extends Article {
|
||||
String title;
|
||||
|
||||
public Audio(String code, double price, String title) {
|
||||
super(code, price);
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
abstract void print();
|
||||
|
||||
}
|
16
Code/Steiner/dynamicCasting/src/Book.java
Normal file
16
Code/Steiner/dynamicCasting/src/Book.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
public class Book extends Article {
|
||||
String author;
|
||||
String title;
|
||||
|
||||
public Book(String code, double price, String author, String title) {
|
||||
super(code, price);
|
||||
this.author = author;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
void print() {
|
||||
System.out.println(this.author + " - " + this.title);
|
||||
System.out.println("Code: " + super.code + "\nPrice: " + super.price);
|
||||
}
|
||||
}
|
27
Code/Steiner/dynamicCasting/src/CD.java
Normal file
27
Code/Steiner/dynamicCasting/src/CD.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
import java.util.ArrayList;
|
||||
|
||||
public class CD extends Audio {
|
||||
ArrayList<String> tracks = new ArrayList<>();
|
||||
|
||||
public CD(String code, double price, String title, ArrayList<String> tracks) {
|
||||
super(code, price, title);
|
||||
this.tracks = tracks;
|
||||
}
|
||||
|
||||
@Override
|
||||
void print() {
|
||||
System.out.println("Title: " + title);
|
||||
System.out.println("Code: " + super.code + "\nPrice: " + super.price);
|
||||
for (String string : tracks) {
|
||||
System.out.println(string);
|
||||
}
|
||||
}
|
||||
|
||||
void playTrack() {
|
||||
int i = 1;
|
||||
for (String string : tracks) {
|
||||
System.out.println("Play track " + i + " " + string + " der CD " + title);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
14
Code/Steiner/dynamicCasting/src/Camera.java
Normal file
14
Code/Steiner/dynamicCasting/src/Camera.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
public class Camera extends Article {
|
||||
String brand;
|
||||
|
||||
public Camera(String code, double price, String brand) {
|
||||
super(code, price);
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
@Override
|
||||
void print() {
|
||||
System.out.println("Brand: " + this.brand);
|
||||
System.out.println("Code: " + super.code + "\nPrice: " + super.price);
|
||||
}
|
||||
}
|
15
Code/Steiner/dynamicCasting/src/MP3.java
Normal file
15
Code/Steiner/dynamicCasting/src/MP3.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
public class MP3 extends Audio {
|
||||
String lengh;
|
||||
|
||||
public MP3(String code, double price, String title, String lengh) {
|
||||
super(code, price, title);
|
||||
this.lengh = lengh;
|
||||
}
|
||||
|
||||
@Override
|
||||
void print() {
|
||||
System.out.println("Title: " + title);
|
||||
System.out.println("Code: " + super.code + "\nPrice: " + super.price);
|
||||
System.out.println("Lengh: " + lengh + " (this was not my typo i was forced to do this)");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue