Dateien nach "/" hochladen
Erstellen der Klasse Products mit Konstruktur sowie der erstellung der Grundpreis Rechnungmain
commit
e4801d4c8f
|
|
@ -0,0 +1,54 @@
|
||||||
|
package Shop;
|
||||||
|
public class OnlineShop{
|
||||||
|
|
||||||
|
public static void main (String [] args){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Products{
|
||||||
|
private String Name;
|
||||||
|
private double weight;
|
||||||
|
private double netWorth;
|
||||||
|
private double tax;
|
||||||
|
private int stock;
|
||||||
|
|
||||||
|
// Constructor for the Products class
|
||||||
|
public Products(String Name, double weight, double netWorth, double tax, int stock) {
|
||||||
|
this.Name = Name;
|
||||||
|
this.weight = weight;
|
||||||
|
this.netWorth = netWorth;
|
||||||
|
this.tax = tax;
|
||||||
|
this.stock = stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName(){
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
public double getWeight(){
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
public double getNetWorth(){
|
||||||
|
return netWorth;
|
||||||
|
}
|
||||||
|
public double getTax(){
|
||||||
|
return tax;
|
||||||
|
}
|
||||||
|
public int getStock(){
|
||||||
|
return stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Brutto Preis
|
||||||
|
public double getGrossPrice(){
|
||||||
|
return this.netWorth *(1+this.tax/100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reine Steuer
|
||||||
|
public double getTaxAmount(){
|
||||||
|
return this.getGrossPrice()-this.netWorth;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue