31 lines
666 B
Java
31 lines
666 B
Java
public class Prudukt {
|
|
private String name;
|
|
private int id;
|
|
private float preis;
|
|
private float gewicht; // Gewicht des Produkts
|
|
|
|
public Prudukt(String name, int id, float preis, float gewicht) {
|
|
this.name = name;
|
|
this.id = id;
|
|
this.preis = preis;
|
|
this.gewicht = gewicht;
|
|
}
|
|
|
|
public float getPreis() {
|
|
return preis;
|
|
}
|
|
|
|
public float getGewicht() {
|
|
return gewicht;
|
|
}
|
|
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "ID: " + id + ", Name: " + name + ", Preis: " + preis + " Euro, Gewicht: " + gewicht + " kg";
|
|
}
|
|
}
|