Compare commits
No commits in common. "Finishing" and "master" have entirely different histories.
|
@ -1,7 +0,0 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<ScalaCodeStyleSettings>
|
||||
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||
</ScalaCodeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
|
@ -1,5 +0,0 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
|
@ -8,7 +8,7 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" default="true" project-jdk-name="openjdk-20" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="openjdk-20" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,23 +1,7 @@
|
|||
package org.example;
|
||||
|
||||
import org.example.framework.framecreater;
|
||||
import org.example.objekts.Bibiliotek;
|
||||
import org.example.objekts.kunden;
|
||||
|
||||
import static org.example.objekts.Bibiliotek.addshit;
|
||||
import static org.example.objekts.Bibiliotek.kundenliste;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
//add the medien
|
||||
//admin
|
||||
kundenliste.add(new kunden(false,0));
|
||||
addshit();
|
||||
Bibiliotek.setAngemeldeterbenuter(-1);
|
||||
Bibiliotek.setFilter("Kein Filter");
|
||||
|
||||
framecreater.Startframe();
|
||||
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -1,513 +0,0 @@
|
|||
package org.example.framework;
|
||||
|
||||
import org.example.objekts.Bibiliotek;
|
||||
import org.example.objekts.Medien;
|
||||
import org.example.objekts.kunden;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.time.DateTimeException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.example.objekts.Bibiliotek.*;
|
||||
|
||||
|
||||
public class framecreater implements ActionListener {
|
||||
|
||||
|
||||
public static void Startframe(){
|
||||
//frame
|
||||
JFrame frame=new JFrame("Bibiliotek");
|
||||
JPanel panel=new JPanel();
|
||||
frame.setSize(700,900);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
frame.add(panel);
|
||||
panel.setLayout(null);
|
||||
|
||||
//anmelde button --> Chanche later if user is angemeldet
|
||||
JButton anemelden=new JButton(Bibiliotek.getAngemeldeterbenuter()<0 ? "Anmelden" : "Profiel");
|
||||
anemelden.setBounds(600,10,90,25);
|
||||
anemelden.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
if(getAngemeldeterbenuter()<0){
|
||||
anmeldeframe();
|
||||
} else {
|
||||
profilframe();
|
||||
}
|
||||
});
|
||||
panel.add(anemelden);
|
||||
|
||||
//date button
|
||||
JButton datum=new JButton(Bibiliotek.getDatum().toString());
|
||||
datum.setBounds(490,10,100,25);
|
||||
datum.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
Zeitframe();
|
||||
});
|
||||
panel.add(datum);
|
||||
|
||||
//filter button
|
||||
JButton filter=new JButton("Filter");
|
||||
filter.setBounds(10,10,80,25);
|
||||
filter.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
Filterframe();
|
||||
});
|
||||
panel.add(filter);
|
||||
|
||||
//suche feld
|
||||
JTextField Sucher=new JTextField(20);
|
||||
Sucher.setText(getSeartch()!=null ? getSeartch() : "");
|
||||
Sucher.setBounds(100,10,300,25);
|
||||
Sucher.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
setSeartch(Sucher.getText());
|
||||
Startframe();
|
||||
});
|
||||
panel.add(Sucher);
|
||||
|
||||
//filter by writing
|
||||
ArrayList<Medien> filterlist=new ArrayList<>();
|
||||
if(Sucher.getText().equals("")){
|
||||
filterlist=medienliste;
|
||||
} else {
|
||||
for(Medien m : medienliste)if(m.getTitel()!=null && m.getTitel().toLowerCase().startsWith(Sucher.getText().toLowerCase()))filterlist.add(m);
|
||||
}
|
||||
|
||||
//create blocks for the inventory
|
||||
final int[] counter = {0};
|
||||
filterlist.forEach(m -> {
|
||||
if(m.getClass().getName().substring(20).equals(getFilter())){
|
||||
panel.add(createbutton(m,counter[0],frame));
|
||||
counter[0]++;
|
||||
} else if (getFilter().equals("Kein Filter")) {
|
||||
panel.add(createbutton(m,counter[0],frame));
|
||||
counter[0]++;
|
||||
} else if (getFilter().equals("Ausgeliehen") && m.getAusgeliehen()>=0) {
|
||||
panel.add(createbutton(m,counter[0],frame));
|
||||
counter[0]++;
|
||||
} else if (getFilter().equals("Verfügbar") && m.getAusgeliehen()<0) {
|
||||
panel.add(createbutton(m,counter[0],frame));
|
||||
counter[0]++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static JButton createbutton(Medien m, int counter, JFrame frame){
|
||||
JButton vorlage=new JButton("<html>"+m.getClass().getName().substring(20)
|
||||
+"<br>"+(m.getAutor()==null ? "Unbekannt" : m.getAutor())
|
||||
+"<br>"+(m.getTitel()==null ? "Unbekannt" : m.getTitel())
|
||||
+"<br>"+(m.getBeschreibung()==null ? "NoData" : m.getBeschreibung())
|
||||
+"<br>"+(m.getVerofentlichung()<=0 ? "NoData" : m.getVerofentlichung())
|
||||
+"<br>"+(m.getAusgeliehen()>=0 ? "Ausgeliehen" : "Verfügbar")
|
||||
+"</html>");
|
||||
vorlage.setBounds(30+(80*(counter%8)),50+(100*(counter/10)),80,100 );
|
||||
vorlage.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
onmedienclick(m);
|
||||
});
|
||||
return vorlage;
|
||||
}
|
||||
public static JButton createprofilebutton(Medien m, int counter, JFrame frame,kunden k){
|
||||
JButton vorlage=new JButton("<html>"+m.getClass().getName().substring(20)
|
||||
+"<br>"+(m.getAutor()==null ? "Unbekannt" : m.getAutor())
|
||||
+"<br>"+(m.getTitel()==null ? "Unbekannt" : m.getTitel())
|
||||
+"<br>"+(m.getBeschreibung()==null ? "NoData" : m.getBeschreibung())
|
||||
+"<br>"+(m.getVerofentlichung()<=0 ? "NoData" : m.getVerofentlichung())
|
||||
+"<br>"+((m.getAusleizeit()*7)-((int) ChronoUnit.DAYS.between(k.getAusgeliehen().get(m),getDatum())))+" Tage"
|
||||
+"</html>");
|
||||
vorlage.setBounds(10+(80*(counter%4)),100+(100*(counter/4)),80,100 );
|
||||
vorlage.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
onmedienclick(m);
|
||||
});
|
||||
return vorlage;
|
||||
}
|
||||
public static void Zeitframe(){
|
||||
|
||||
System.out.println(Bibiliotek.getDatum().toString());
|
||||
//frame
|
||||
JFrame frame=new JFrame("Zeit Einstellung");
|
||||
JPanel panel=new JPanel();
|
||||
frame.setSize(400,200);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
frame.add(panel);
|
||||
panel.setLayout(null);
|
||||
|
||||
//text feld
|
||||
JLabel text=new JLabel("Gib ein neues datum ein JJJJ-MM-DD");
|
||||
text.setBounds(10,70,400,25);
|
||||
panel.add(text);
|
||||
|
||||
//date feld
|
||||
JTextField jear=new JTextField(20);
|
||||
jear.setBounds(10,100,50,25);
|
||||
panel.add(jear);
|
||||
JTextField month=new JTextField(20);
|
||||
month.setBounds(60,100,50,25);
|
||||
panel.add(month);
|
||||
JTextField day=new JTextField(20);
|
||||
day.setBounds(110,100,50,25);
|
||||
panel.add(day);
|
||||
|
||||
//succes button
|
||||
JButton succes=new JButton("Weiter");
|
||||
succes.setBounds(100,130,80,25);
|
||||
succes.addActionListener(e -> {
|
||||
try {
|
||||
Bibiliotek.setDatum(LocalDate.of(
|
||||
Integer.valueOf(jear.getText()),
|
||||
Integer.valueOf(month.getText()),
|
||||
Integer.valueOf(day.getText())));
|
||||
} catch (NumberFormatException ec){
|
||||
text.setText("Bitte Richtiges Vormat wählen JJJJ-MM-DD");
|
||||
return;
|
||||
} catch (DateTimeException ec){
|
||||
text.setText("Bitte Richtiges Vormat wählen JJJJ-MM-DD");
|
||||
return;
|
||||
}
|
||||
frame.dispose();
|
||||
Startframe();
|
||||
});
|
||||
panel.add(succes);
|
||||
|
||||
//back button
|
||||
JButton back=new JButton("Zurück");
|
||||
back.setBounds(10,130,80,25);
|
||||
back.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
Startframe();
|
||||
});
|
||||
panel.add(back);
|
||||
}
|
||||
|
||||
public static void Filterframe(){
|
||||
//frame
|
||||
JFrame frame=new JFrame("Filter auswählen");
|
||||
JPanel panel=new JPanel();
|
||||
ArrayList<String> filterliste=new ArrayList<>();
|
||||
filterliste.add("Buch");
|
||||
filterliste.add("DVD");
|
||||
filterliste.add("CD");
|
||||
filterliste.add("Brettspiel");
|
||||
filterliste.add("Videospiel");
|
||||
filterliste.add("Ausgeliehen");
|
||||
filterliste.add("Verfügbar");
|
||||
filterliste.add("Kein Filter");
|
||||
frame.setSize(220,filterliste.size()*25+55);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
frame.add(panel);
|
||||
panel.setLayout(null);
|
||||
|
||||
filterliste.forEach(s -> {
|
||||
//buch button
|
||||
JButton buch=new JButton(s);
|
||||
buch.setBounds(10,10+(25*filterliste.indexOf(s)),190,25);
|
||||
buch.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
setFilter(s);
|
||||
Startframe();
|
||||
});
|
||||
panel.add(buch);
|
||||
});
|
||||
}
|
||||
|
||||
public static void anmeldeframe(){
|
||||
//frame
|
||||
JFrame frame=new JFrame("Anmelden");
|
||||
JPanel panel=new JPanel();
|
||||
frame.setSize(400,200);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
frame.add(panel);
|
||||
panel.setLayout(null);
|
||||
|
||||
//text feld
|
||||
JLabel text=new JLabel("Bitte gib deine Kundennummer ein:");
|
||||
text.setBounds(10,70,400,25);
|
||||
panel.add(text);
|
||||
|
||||
//date feld
|
||||
JTextField jear=new JTextField(20);
|
||||
jear.setBounds(10,100,100,25);
|
||||
panel.add(jear);
|
||||
|
||||
//succes button
|
||||
JButton succes=new JButton("Anmelden");
|
||||
succes.setBounds(90,130,90,25);
|
||||
succes.addActionListener( e -> {
|
||||
try {
|
||||
if(kundenliste.get(Integer.valueOf(jear.getText()))!=null){
|
||||
setAngemeldeterbenuter(Integer.valueOf(jear.getText()));
|
||||
frame.dispose();
|
||||
Startframe();
|
||||
} else {
|
||||
text.setText("Falsche Nummer, bitte versuche es erneut");
|
||||
}
|
||||
} catch (NumberFormatException ec){
|
||||
text.setText("Falsche Nummer, bitte versuche es erneut");
|
||||
} catch (IndexOutOfBoundsException ec){
|
||||
text.setText("Falsche Nummer, bitte versuche es erneut");
|
||||
}
|
||||
});
|
||||
panel.add(succes);
|
||||
|
||||
//regestrieren button
|
||||
JButton regestrieren=new JButton("Registrieren");
|
||||
regestrieren.setBounds(180,130,80,25);
|
||||
regestrieren.addActionListener( e -> {
|
||||
kundenliste.add(new kunden(false,(kundenliste.size())));
|
||||
setAngemeldeterbenuter(kundenliste.size()-1);
|
||||
frame.dispose();
|
||||
Startframe();
|
||||
});
|
||||
panel.add(regestrieren);
|
||||
|
||||
//back button
|
||||
JButton back=new JButton("Zurück");
|
||||
back.setBounds(10,130,80,25);
|
||||
back.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
Startframe();
|
||||
});
|
||||
panel.add(back);
|
||||
}
|
||||
|
||||
public static void profilframe(){
|
||||
//frame
|
||||
JFrame frame=new JFrame("Profil");
|
||||
JPanel panel=new JPanel();
|
||||
frame.setSize(400,800);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
frame.add(panel);
|
||||
panel.setLayout(null);
|
||||
|
||||
kunden k=kundenliste.get(getAngemeldeterbenuter());
|
||||
|
||||
//text feld
|
||||
JLabel nummer=new JLabel("Kunden Nummer: "+(k.getnummer()));
|
||||
nummer.setBounds(10,10,200,25);
|
||||
panel.add(nummer);
|
||||
|
||||
//text feld
|
||||
JLabel schulden=new JLabel("Schulden: "+k.getSchulden()+"€");
|
||||
schulden.setBounds( 10,30,200,25);
|
||||
panel.add(schulden);
|
||||
|
||||
//schuldenzuruck button
|
||||
JButton schuldenzuruck=new JButton("Abezahlen");
|
||||
schuldenzuruck.setBounds(170,30,80,25);
|
||||
schuldenzuruck.addActionListener( e -> {
|
||||
if(!schuldenabezahlen.contains(k))schuldenabezahlen.add(k);
|
||||
});
|
||||
if(k.getSchulden()>0.0)panel.add(schuldenzuruck);
|
||||
|
||||
//studentstatus feld
|
||||
JLabel studentstatus=new JLabel("Student/Schühler: "+( k.isIstStudent()? "Ja" : "Nein"));
|
||||
studentstatus.setBounds(10,50,200,25);
|
||||
panel.add(studentstatus);
|
||||
|
||||
//studentstatus button
|
||||
JButton succes=new JButton("Ändern");
|
||||
succes.setBounds(170,50,80,25);
|
||||
succes.addActionListener( e -> {
|
||||
frame.dispose();
|
||||
k.setIstStudent(!k.isIstStudent());
|
||||
profilframe();
|
||||
});
|
||||
panel.add(succes);
|
||||
|
||||
//ausgeliehene sachen
|
||||
final int[] i = {0};
|
||||
k.getAusgeliehen().keySet().forEach(m -> {
|
||||
panel.add(createprofilebutton(m,i[0],frame,k));
|
||||
i[0]++;
|
||||
});
|
||||
|
||||
//back button
|
||||
JButton back=new JButton("Zurück");
|
||||
back.setBounds(10,725,80,25);
|
||||
back.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
Startframe();
|
||||
});
|
||||
panel.add(back);
|
||||
|
||||
//abmelden button
|
||||
JButton abmelden=new JButton("Abmelden");
|
||||
abmelden.setBounds(90,725,100,25);
|
||||
abmelden.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
setAngemeldeterbenuter(-1);
|
||||
Startframe();
|
||||
});
|
||||
panel.add(abmelden);
|
||||
|
||||
//admin schulden erlass knopf
|
||||
JButton admin=new JButton("Gebüren Verbuchen");
|
||||
admin.setBounds(170,725,200,25);
|
||||
admin.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
adminclick();
|
||||
});
|
||||
if(getAngemeldeterbenuter()==0)panel.add(admin);
|
||||
}
|
||||
|
||||
public static void onmedienclick(Medien m){
|
||||
//frame
|
||||
JFrame frame=new JFrame("Medien");
|
||||
JPanel panel=new JPanel();
|
||||
frame.setSize(300,200);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
frame.add(panel);
|
||||
panel.setLayout(null);
|
||||
|
||||
//text feld
|
||||
JLabel autor=new JLabel("Autor: "+(m.getAutor()==null ? "Unbekannt" : m.getAutor()));
|
||||
autor.setBounds(10,10,200,25);
|
||||
panel.add(autor);
|
||||
|
||||
//text feld
|
||||
JLabel titel=new JLabel("Titel: "+(m.getTitel()==null ? "Unbekannt" : m.getTitel()));
|
||||
titel.setBounds( 10,30,200,25);
|
||||
panel.add(titel);
|
||||
|
||||
//text feld
|
||||
JLabel Beschreibung=new JLabel("Beschreibung: "+(m.getBeschreibung()==null ? "NoData" : m.getBeschreibung()));
|
||||
Beschreibung.setBounds(10,50,200,25);
|
||||
panel.add(Beschreibung);
|
||||
|
||||
//text feld
|
||||
JLabel verofentlichung=new JLabel("Veröfentlichung: "+(m.getVerofentlichung()<=0 ? "NoData" : m.getVerofentlichung()));
|
||||
verofentlichung.setBounds(10,70,200,25);
|
||||
panel.add(verofentlichung);
|
||||
|
||||
//text feld
|
||||
JLabel ausleihzeit=new JLabel("Ausleihzeit: "+m.getAusleizeit()+" Wochen");
|
||||
ausleihzeit.setBounds(10,100,200,25);
|
||||
panel.add(ausleihzeit);
|
||||
|
||||
//back button
|
||||
JButton back=new JButton("Zurück");
|
||||
back.setBounds(10,125,80,25);
|
||||
back.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
Startframe();
|
||||
});
|
||||
panel.add(back);
|
||||
|
||||
//ausleiehen button
|
||||
JButton ausleiehen=new JButton("Ausleiehen");
|
||||
ausleiehen.setBounds(90,125,100,25);
|
||||
ausleiehen.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
m.setAusgeliehen(getAngemeldeterbenuter());
|
||||
kundenliste.get(getAngemeldeterbenuter()).getAusgeliehen().put(m,getDatum());
|
||||
Startframe();
|
||||
});
|
||||
if(m.getAusgeliehen()<0 && getAngemeldeterbenuter()>=0)panel.add(ausleiehen);
|
||||
if(m.getAusgeliehen()>=0 && m.getAusgeliehen()==getAngemeldeterbenuter()){
|
||||
//zuruckgeben button
|
||||
JButton zuruckgeben=new JButton("Zurückgeben");
|
||||
zuruckgeben.setBounds(90,125,100,25);
|
||||
zuruckgeben.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
m.setAusgeliehen(-1);
|
||||
schuldenberechnung(m,kundenliste.get(getAngemeldeterbenuter()));
|
||||
kundenliste.get(getAngemeldeterbenuter()).getAusgeliehen().remove(m);
|
||||
profilframe();
|
||||
});
|
||||
panel.add(zuruckgeben);
|
||||
|
||||
//Verlängern button
|
||||
JButton Verlängern=new JButton("Verlängern");
|
||||
Verlängern.setBounds(150,100,100,25);
|
||||
Verlängern.addActionListener(e -> {
|
||||
//set max verlängerungen
|
||||
int verlangerung = m.getAusleizeit();
|
||||
if(m.getClass().getName().substring(20).equals("Buch") && verlangerung<(4*4))verlangerung+=4;
|
||||
if(m.getClass().getName().substring(20).equals("Viedeospiel") && verlangerung==4)verlangerung*=2;
|
||||
frame.dispose();
|
||||
m.setAusleizeit(verlangerung);
|
||||
onmedienclick(m);
|
||||
});
|
||||
|
||||
if(m.getClass().getName().substring(20).equals("Buch"))panel.add(Verlängern);
|
||||
if(m.getClass().getName().substring(20).equals("Viedeospiel"))panel.add(Verlängern);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void adminclick(){
|
||||
//frame
|
||||
JFrame frame=new JFrame("Gebüren Verbuchen");
|
||||
JPanel panel=new JPanel();
|
||||
frame.setSize(300,100+(schuldenabezahlen.size()*30));
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
frame.add(panel);
|
||||
panel.setLayout(null);
|
||||
|
||||
schuldenabezahlen.forEach(k -> {
|
||||
//info feld
|
||||
JLabel kunde=new JLabel("Nr: "+k.getnummer()+" Schulden: "+k.getSchulden()+"€");
|
||||
kunde.setBounds(10,schuldenabezahlen.indexOf(k)*25,200,25);
|
||||
panel.add(kunde);
|
||||
|
||||
//admin schulden erlass knopf
|
||||
JButton admin=new JButton("Bezahlt");
|
||||
admin.setBounds(200,schuldenabezahlen.indexOf(k)*25,80,25);
|
||||
admin.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
k.setSchulden(0.0);
|
||||
schuldenabezahlen.remove(k);
|
||||
adminclick();
|
||||
});
|
||||
panel.add(admin);
|
||||
});
|
||||
//back
|
||||
JButton back=new JButton("Zurück");
|
||||
back.setBounds(10,schuldenabezahlen.size()*25,80,25);
|
||||
back.addActionListener(e -> {
|
||||
frame.dispose();
|
||||
profilframe();
|
||||
});
|
||||
panel.add(back);
|
||||
}
|
||||
|
||||
public static void schuldenberechnung(Medien m, kunden k){
|
||||
LocalDate datenow=getDatum();
|
||||
LocalDate datethen=k.getAusgeliehen().get(m);
|
||||
|
||||
//set max verlängerungen
|
||||
int verlangerung = m.getAusleizeit()*7;
|
||||
|
||||
//wochen berechnen
|
||||
int weeksapart = ((int) ChronoUnit.DAYS.between(datethen,datenow));
|
||||
if(weeksapart>verlangerung){
|
||||
weeksapart-=verlangerung;
|
||||
int schulden=0;
|
||||
if(weeksapart<7){
|
||||
schulden=weeksapart;
|
||||
} else {
|
||||
weeksapart-=7;
|
||||
schulden=weeksapart*2;
|
||||
}
|
||||
if(k.isIstStudent())schulden/=2;
|
||||
k.setSchulden(k.getSchulden()+schulden);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
package org.example.objekts;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Bibiliotek {
|
||||
|
||||
//create lists to track shit
|
||||
public static ArrayList<Medien> medienliste=new ArrayList<>();
|
||||
public static ArrayList<kunden> kundenliste=new ArrayList<>();
|
||||
public static ArrayList<kunden> schuldenabezahlen=new ArrayList<>();
|
||||
|
||||
private static int Angemeldeterbenuter;
|
||||
|
||||
private static String Filter;
|
||||
|
||||
private static String Seartch;
|
||||
|
||||
|
||||
// Global system date, initialized to the current date
|
||||
private static LocalDate datum = LocalDate.now();
|
||||
|
||||
// Get the current system date
|
||||
public static LocalDate getDatum() {
|
||||
return datum;
|
||||
}
|
||||
|
||||
// Update the system date
|
||||
public static void setDatum(LocalDate newDate) {
|
||||
datum = newDate;
|
||||
}
|
||||
|
||||
public static int getAngemeldeterbenuter() {
|
||||
return Angemeldeterbenuter;
|
||||
}
|
||||
|
||||
public static void setAngemeldeterbenuter(int angemeldeterbenuter) {
|
||||
Angemeldeterbenuter = angemeldeterbenuter;
|
||||
}
|
||||
|
||||
public static String getFilter() {
|
||||
return Filter;
|
||||
}
|
||||
|
||||
public static void setFilter(String filter) {
|
||||
Filter = filter;
|
||||
}
|
||||
|
||||
public static String getSeartch() {
|
||||
return Seartch;
|
||||
}
|
||||
|
||||
public static void setSeartch(String seartch) {
|
||||
Seartch = seartch;
|
||||
}
|
||||
|
||||
public static void addshit(){
|
||||
medienliste.add(new Buch("Schmi","Schmitt","",1));
|
||||
medienliste.add(new DVD("Schmi2","SH","s",1));
|
||||
medienliste.add(new Buch("Schmi3","","s",1));
|
||||
medienliste.add(new Buch("Schmi4","","",1));
|
||||
medienliste.add(new Buch("Schmi5","","",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new DVD("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new DVD("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch("Schmi6","","as",1));
|
||||
medienliste.add(new Buch(null,null,null,0));
|
||||
}
|
||||
}
|
|
@ -1,355 +0,0 @@
|
|||
package org.example.objekts;
|
||||
|
||||
public abstract class Medien {
|
||||
|
||||
private String autor;
|
||||
private String titel;
|
||||
private String beschreibung;
|
||||
private int nummer;
|
||||
private int verofentlichung;
|
||||
|
||||
private int ausleizeit;
|
||||
private int ausgeliehen;
|
||||
|
||||
abstract public String getAutor();
|
||||
abstract public String getTitel();
|
||||
abstract public String getBeschreibung();
|
||||
abstract public int getNummer();
|
||||
abstract public int getVerofentlichung();
|
||||
abstract public int getAusgeliehen();
|
||||
abstract public int getAusleizeit();
|
||||
|
||||
public void setAusgeliehen(int ausgeliehen) {
|
||||
this.ausgeliehen = ausgeliehen;
|
||||
}
|
||||
|
||||
public void setAusleizeit(int ausleizeit) {
|
||||
this.ausleizeit = ausleizeit;
|
||||
}
|
||||
}
|
||||
|
||||
class Buch extends Medien{
|
||||
|
||||
private String autor;
|
||||
private String titel;
|
||||
private String beschreibung;
|
||||
private int verofentlichung;
|
||||
private int nummber;
|
||||
private int ausgeliehen;
|
||||
private int ausleizeit;
|
||||
|
||||
|
||||
public Buch(String autor, String titel, String beschreibung, int verofentlichung){
|
||||
this.autor=autor;
|
||||
this.titel=titel;
|
||||
this.beschreibung=beschreibung;
|
||||
this.verofentlichung=verofentlichung;
|
||||
this.nummber=Bibiliotek.medienliste.size()+1; //test it
|
||||
this.ausgeliehen=-1;
|
||||
this.ausleizeit=4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAusgeliehen(int ausgeliehen) {
|
||||
this.ausgeliehen = ausgeliehen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitel() {
|
||||
return titel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBeschreibung() {
|
||||
return beschreibung;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNummer() {
|
||||
return nummber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVerofentlichung() {
|
||||
return verofentlichung;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAusgeliehen() {
|
||||
return ausgeliehen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAusleizeit() {
|
||||
return ausleizeit;
|
||||
}
|
||||
@Override
|
||||
public void setAusleizeit(int ausleizeit) {
|
||||
this.ausleizeit = ausleizeit;
|
||||
}
|
||||
}
|
||||
class DVD extends Medien{
|
||||
|
||||
private String autor;
|
||||
private String titel;
|
||||
private String beschreibung;
|
||||
private int verofentlichung;
|
||||
private int nummber;
|
||||
private int ausgeliehen;
|
||||
|
||||
|
||||
public DVD(String autor, String titel, String beschreibung, int verofentlichung){
|
||||
this.autor=autor;
|
||||
this.titel=titel;
|
||||
this.beschreibung=beschreibung;
|
||||
this.verofentlichung=verofentlichung;
|
||||
this.nummber=Bibiliotek.medienliste.size()+1; //test it
|
||||
this.ausgeliehen=-1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAusleizeit(int ausleizeit) {
|
||||
super.setAusleizeit(ausleizeit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAusgeliehen(int ausgeliehen) {
|
||||
this.ausgeliehen = ausgeliehen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitel() {
|
||||
return titel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBeschreibung() {
|
||||
return beschreibung;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNummer() {
|
||||
return nummber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVerofentlichung() {
|
||||
return verofentlichung;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAusgeliehen() {
|
||||
return ausgeliehen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAusleizeit() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
class CD extends Medien{
|
||||
|
||||
private String autor;
|
||||
private String titel;
|
||||
private String beschreibung;
|
||||
private int verofentlichung;
|
||||
private int nummber;
|
||||
private int ausgeliehen;
|
||||
|
||||
|
||||
public CD(String autor, String titel, String beschreibung, int verofentlichung){
|
||||
this.autor=autor;
|
||||
this.titel=titel;
|
||||
this.beschreibung=beschreibung;
|
||||
this.verofentlichung=verofentlichung;
|
||||
this.nummber=Bibiliotek.medienliste.size()+1; //test it
|
||||
this.ausgeliehen=-1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAusgeliehen(int ausgeliehen) {
|
||||
this.ausgeliehen = ausgeliehen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAusleizeit(int ausleizeit) {
|
||||
super.setAusleizeit(ausleizeit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitel() {
|
||||
return titel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBeschreibung() {
|
||||
return beschreibung;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNummer() {
|
||||
return nummber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVerofentlichung() {
|
||||
return verofentlichung;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAusgeliehen() {
|
||||
return ausgeliehen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAusleizeit() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
class Brettspiel extends Medien{
|
||||
|
||||
private String autor;
|
||||
private String titel;
|
||||
private String beschreibung;
|
||||
private int verofentlichung;
|
||||
private int nummber;
|
||||
private int ausgeliehen;
|
||||
|
||||
|
||||
public Brettspiel(String autor, String titel, String beschreibung, int verofentlichung){
|
||||
this.autor=autor;
|
||||
this.titel=titel;
|
||||
this.beschreibung=beschreibung;
|
||||
this.verofentlichung=verofentlichung;
|
||||
this.nummber=Bibiliotek.medienliste.size()+1; //test it
|
||||
this.ausgeliehen=-1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAusleizeit(int ausleizeit) {
|
||||
super.setAusleizeit(ausleizeit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAusgeliehen(int ausgeliehen) {
|
||||
this.ausgeliehen = ausgeliehen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitel() {
|
||||
return titel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBeschreibung() {
|
||||
return beschreibung;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNummer() {
|
||||
return nummber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVerofentlichung() {
|
||||
return verofentlichung;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAusgeliehen() {
|
||||
return ausgeliehen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAusleizeit() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
class Viedeospiel extends Medien{
|
||||
|
||||
private String autor;
|
||||
private String titel;
|
||||
private String beschreibung;
|
||||
private int verofentlichung;
|
||||
private int nummber;
|
||||
private int ausgeliehen;
|
||||
private int ausleizeit;
|
||||
|
||||
|
||||
public Viedeospiel(String autor, String titel, String beschreibung, int verofentlichung){
|
||||
this.autor=autor;
|
||||
this.titel=titel;
|
||||
this.beschreibung=beschreibung;
|
||||
this.verofentlichung=verofentlichung;
|
||||
this.nummber=Bibiliotek.medienliste.size()+1; //test it
|
||||
this.ausgeliehen=-1;
|
||||
this.ausleizeit=4;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setAusgeliehen(int ausgeliehen) {
|
||||
this.ausgeliehen = ausgeliehen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAusleizeit(int ausleizeit) {
|
||||
this.ausleizeit = ausleizeit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitel() {
|
||||
return titel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBeschreibung() {
|
||||
return beschreibung;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNummer() {
|
||||
return nummber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVerofentlichung() {
|
||||
return verofentlichung;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAusgeliehen() {
|
||||
return ausgeliehen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAusleizeit() {
|
||||
return ausleizeit;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package org.example.objekts;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class kunden {
|
||||
|
||||
private int nummer;
|
||||
private boolean istStudent;
|
||||
private double schulden;
|
||||
public HashMap<Medien, LocalDate> ausgeliehen;
|
||||
|
||||
public kunden(boolean istStudent, int nummer) {
|
||||
this.istStudent = istStudent;
|
||||
this.nummer = nummer;
|
||||
this.schulden = 0;
|
||||
this.ausgeliehen=new HashMap<>();
|
||||
}
|
||||
|
||||
public double getSchulden() {
|
||||
return schulden;
|
||||
}
|
||||
|
||||
public int getnummer() {
|
||||
return nummer;
|
||||
}
|
||||
|
||||
public HashMap<Medien, LocalDate> getAusgeliehen() {
|
||||
return ausgeliehen;
|
||||
}
|
||||
|
||||
public boolean isIstStudent() {
|
||||
return istStudent;
|
||||
}
|
||||
|
||||
public void setSchulden(double schulden) {
|
||||
this.schulden = schulden;
|
||||
}
|
||||
|
||||
public void setIstStudent(boolean istStudent) {
|
||||
this.istStudent = istStudent;
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,5 +0,0 @@
|
|||
#Generated by Maven
|
||||
#Thu Nov 14 17:11:20 CET 2024
|
||||
artifactId=Bibikiotek
|
||||
groupId=org.example
|
||||
version=1.0-SNAPSHOT
|
|
@ -1,2 +0,0 @@
|
|||
C:\Users\kai\OneDrive\Programieren\java\Pr2\Testat3\Bibikiotek\src\main\java\org\example\framework\framecreater.java
|
||||
C:\Users\kai\OneDrive\Programieren\java\Pr2\Testat3\Bibikiotek\src\main\java\org\example\Main.java
|
|
@ -1,34 +0,0 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<!DOCTYPE web-app PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
|
||||
<web-app>
|
||||
<filter>
|
||||
<filter-name>doxia</filter-name>
|
||||
<filter-class>org.apache.maven.plugins.site.webapp.DoxiaFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>doxia</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
</web-app>
|
Loading…
Reference in New Issue