Initial commite

main
Alexander Wiederroth 2025-01-13 23:29:29 +01:00 committed by alexbiba
parent 7548d0a67b
commit fc092e49ce
5 changed files with 152 additions and 0 deletions

10
UA/.classpath 100644
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-22">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
UA/.project 100644
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>UA</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,16 @@
public class Aufgaben {
String text;
String status = "[Offen]";
public Aufgaben(String text){
this.text = text;
}
@Override
public String toString() {
return ""+status +" "+text;
}
}

View File

@ -0,0 +1,72 @@
import java.util.*;
public class Projekt {
public static void main (String[] args) {
boolean schleife = true;
Speicher speicher = new Speicher();
Scanner scanner = new Scanner(System.in);
System.out.println("Wie kann ich Ihnen weiter helfen?");
System.out.println("Hier sehen Sie Ihre Optionen:");
System.out.println("1. Aufgaben hinzufügen.");
System.out.println("2. Aufgagben anzeigen.");
System.out.println("3. Aufgabe als erledigt markieren.");
System.out.println("4. Aufgabe löschen.");
System.out.println("5. Programm beenden.");
System.out.println("\"menü\". Menü nochmal zeigen. ");
while(schleife) {
System.out.println("Was wollen Sie nun ausführen?");
String eingabe = scanner.nextLine();
switch(eingabe) {
case "1":
System.out.println("Was für eine neue Aufgabe wollen Sie hinzufügen?");
String text = scanner.nextLine();
Aufgaben aufgabe = new Aufgaben(text);
speicher.addAufgabe(aufgabe);
break;
case "2":
System.out.println("Alle Aufgaben werden nun angezeigt.");
speicher.showAufgaben();
break;
case "3":
System.out.println("Welche Aufgabe wollen Sie als erledigt kennzeichnen?");
speicher.showAufgaben();
int posi = scanner.nextInt();
scanner.nextLine();
Aufgaben temp = speicher.getAufgabe(posi-1);
speicher.setErledigt(posi);
System.out.println("Die Aufgabe "+ temp +" wurde als erledigt gekennzeichnet");
break;
case "4":
System.out.println("Welche Aufgabe möchtest du löschen?");
speicher.showAufgaben();
int del = scanner.nextInt();
scanner.nextLine();
Aufgaben aufgab = speicher.getAufgabe(del-1);
speicher.removeAufgabe(aufgab);
System.out.println("Aufgabe: " + aufgab + " wurde gelöscht.");
break;
case "5":
System.out.println("System wird beendet...");
schleife = false;
break;
case "menü":
System.out.println("1. Aufgaben hinzufügen.");
System.out.println("2. Aufgagben anzeigen.");
System.out.println("3. Aufgabe als erledigt markieren.");
System.out.println("4. Aufgabe löschen.");
System.out.println("5. Programm beenden.");
default:
System.out.println("Ungültige Eingabe. Bitte erneut versuchen.");
}
}scanner.close();
}
}

View File

@ -0,0 +1,37 @@
import java.util.*;
public class Speicher {
ArrayList<Aufgaben> aufgaben;
public Speicher() {
aufgaben = new ArrayList<>();
}
public void addAufgabe(Aufgaben aufgabe) {
aufgaben.add(aufgabe);
}
public void showAufgaben() {
int i = 1;
if(aufgaben.isEmpty()) {
System.out.println("Keine Aufgaben vorhanden.");
}else {
for (Aufgaben aufgabe : aufgaben) {
System.out.println(""+ i +". " + aufgabe);
i++;
}
}
}
public void setErledigt(int a) {
aufgaben.get(a-1).status = "[Erledigt]";
}
public Aufgaben getAufgabe(int a) {
return aufgaben.get(a);
}
public void removeAufgabe(Aufgaben aufgabe) {
aufgaben.remove(aufgabe);
}
}