This commit is contained in:
DH10RBH 2024-04-17 13:39:26 +02:00
parent 32dc2f3f82
commit 45b1db1e2d
2 changed files with 124 additions and 0 deletions

View File

@ -0,0 +1,29 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -0,0 +1,95 @@
public class Main {
public static void main(String[] args) {
enum Monate{Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember}
Monate aktuellerMonat = Monate.August;
String quartal = "";
//a
/* switch(aktuellerMonat){
case Januar:
quartal = "Q1";
break;
case Februar:
quartal = "Q1";
break;
case März:
quartal = "Q1";
break;
case April:
quartal = "Q2";
break;
case Mai:
quartal = "Q2";
break;
case Juni:
quartal = "Q2";
break;
case Juli:
quartal = "Q3";
break;
case August:
quartal = "Q3";
break;
case September:
quartal = "Q3";
break;
case Oktober:
quartal = "Q4";
break;
case November:
quartal = "Q4";
break;
case Dezember:
quartal = "Q4";
break;
default:
quartal = "Kein Monat gefunden."; */
//b
/* switch(aktuellerMonat){
case Januar:
case Februar:
case März:
quartal = "Q1";
break;
case April:
case Mai:
case Juni:
quartal = "Q2";
break;
case Juli, August, September:
quartal = "Q3";
break;
case Oktober, November, Dezember:
quartal = "Q4";
break;
default:
quartal = "Kein Monat gefunden.";
break; */
//cde
switch(aktuellerMonat){
case Januar, Februar, März -> quartal = "Q1";
case April, Mai, Juni -> quartal = "Q2";
case Juli, August, September -> quartal = "Q3";
case Oktober, November, Dezember -> quartal = "Q4";
default -> quartal = "Kein Monat gefunden.";
}
System.out.println("Der aktuelle Monat ist: " + aktuellerMonat + ", zugeordnetes Quartal: " + quartal);
}
}