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/jahrGueltig/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/jahrGueltig/.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/jahrGueltig/README.md
Normal file
18
Code/Steiner/jahrGueltig/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/jahrGueltig/bin/App.class
Normal file
BIN
Code/Steiner/jahrGueltig/bin/App.class
Normal file
Binary file not shown.
117
Code/Steiner/jahrGueltig/src/App.java
Normal file
117
Code/Steiner/jahrGueltig/src/App.java
Normal file
|
@ -0,0 +1,117 @@
|
|||
// Luca Burger
|
||||
// AUFGABE 1
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class App {
|
||||
static Scanner scan = new Scanner(System.in);
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// Nutzer Eingabe
|
||||
System.out.println("Einen Tag bitte (als Zahl)");
|
||||
int tag = scan.nextInt();
|
||||
System.out.println("Einen Monat bitte (als Zahl)");
|
||||
int monat = scan.nextInt();
|
||||
System.out.println("Ein jahr (für vor Christi negative verwenden)");
|
||||
int jahr = scan.nextInt();
|
||||
System.out.println("1. Januar " + jahr + " = 0, Montag .... 6, Sonntag");
|
||||
int startTag = scan.nextInt();
|
||||
|
||||
int tagImJahr = 0;
|
||||
if (tag > 0 && tag <= 31) {
|
||||
switch (monat) {
|
||||
case 1:
|
||||
tagImJahr = tag;
|
||||
break;
|
||||
case 2:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 31;
|
||||
break;
|
||||
case 3:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 59;
|
||||
break;
|
||||
case 4:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 90;
|
||||
break;
|
||||
case 5:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 120;
|
||||
break;
|
||||
case 6:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 150;
|
||||
break;
|
||||
case 7:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 181;
|
||||
break;
|
||||
case 8:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 212;
|
||||
break;
|
||||
case 9:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 242;
|
||||
break;
|
||||
case 10:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 273;
|
||||
break;
|
||||
case 11:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 303;
|
||||
break;
|
||||
case 12:
|
||||
tagImJahr = tag;
|
||||
tagImJahr = tagImJahr + 334;
|
||||
break;
|
||||
default:
|
||||
System.out.println("error");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
System.out.println("error");
|
||||
}
|
||||
|
||||
if (jahr % 4 == 0 && (jahr % 100 != 0 || jahr % 400 == 0)) {
|
||||
tagImJahr++;
|
||||
}
|
||||
System.out.println("Datum: " + tag + "." + monat + "." + jahr);
|
||||
System.out.println(tagImJahr + ". Tag im Jahr");
|
||||
|
||||
// Berechnung welcher Wochentag
|
||||
double woche = tagImJahr / 7;
|
||||
System.out.println("Kalenderwoche: " + (int) woche);
|
||||
int wochentag = (int) woche / startTag;
|
||||
wochentag = -1; // Berechnung hat nicht Funktioniert :(
|
||||
|
||||
switch (wochentag) {
|
||||
case 0:
|
||||
System.out.println("Montag");
|
||||
break;
|
||||
case 1:
|
||||
System.out.println("Dienstag");
|
||||
break;
|
||||
case 2:
|
||||
System.out.println("Mittwoch");
|
||||
break;
|
||||
case 3:
|
||||
System.out.println("Donnerstag");
|
||||
break;
|
||||
case 4:
|
||||
System.out.println("Freitag");
|
||||
break;
|
||||
case 5:
|
||||
System.out.println("Samstag");
|
||||
break;
|
||||
case 6:
|
||||
System.out.println("Sonntag");
|
||||
break;
|
||||
default:
|
||||
System.out.println("Wochentag konnte nicht berechnet werden");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue