2024-10-21 18:52:25 +02:00
|
|
|
public class Prudukt {
|
|
|
|
private String name;
|
|
|
|
private int id;
|
|
|
|
private float preis;
|
2024-10-21 22:35:46 +02:00
|
|
|
private float gewicht;
|
2024-10-21 18:52:25 +02:00
|
|
|
|
2024-10-21 22:35:46 +02:00
|
|
|
// Konstruktor
|
2024-10-21 18:52:25 +02:00
|
|
|
public Prudukt(String name, int id, float preis, float gewicht) {
|
|
|
|
this.name = name;
|
|
|
|
this.id = id;
|
|
|
|
this.preis = preis;
|
|
|
|
this.gewicht = gewicht;
|
|
|
|
}
|
|
|
|
|
2024-10-21 22:35:46 +02:00
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2024-10-21 18:52:25 +02:00
|
|
|
public float getPreis() {
|
|
|
|
return preis;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getGewicht() {
|
|
|
|
return gewicht;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
2024-10-21 22:35:46 +02:00
|
|
|
return String.format("ID: %d, Name: %s, Preis: %.2f Euro, Gewicht: %.2f kg", id, name, preis, gewicht);
|
2024-10-21 18:52:25 +02:00
|
|
|
}
|
|
|
|
}
|