62 lines
1.3 KiB
Java
62 lines
1.3 KiB
Java
package pckg.Backend;
|
|
|
|
public class Produkt {
|
|
private int id;
|
|
private String name;
|
|
private double gewicht;
|
|
private double preis;
|
|
private int mwst;
|
|
int bestand;
|
|
|
|
public Produkt(int id, String name, double gewicht, double preis, int mwst, int bestand) {
|
|
this.id = id;
|
|
this.name = name;
|
|
this.gewicht = gewicht;
|
|
this.preis = preis;
|
|
this.mwst = mwst;
|
|
this.bestand = bestand;
|
|
}
|
|
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
public String getName() {
|
|
return this.name;
|
|
}
|
|
|
|
public double getPreis() {
|
|
return preis;
|
|
}
|
|
|
|
public double getGewicht() {
|
|
return gewicht;
|
|
}
|
|
|
|
public int getMwst() {
|
|
return mwst;
|
|
}
|
|
|
|
public int getBestand() {
|
|
return bestand;
|
|
}
|
|
|
|
public String toString() {
|
|
return id + " | " + name + " | " + preis + "€";
|
|
}
|
|
|
|
public boolean compareSearchName(String suchbegriff) {
|
|
String n = name.toLowerCase();
|
|
String s = suchbegriff.toLowerCase();
|
|
|
|
for (int i = 0; i <= n.length() - s.length(); i++) {
|
|
if (n.startsWith(s, i)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|