I created 4 objects, each has its own dichte value (density), and should have its masse value (mass). Mass is calculated as density * volume . How do I implement this? What would the program calculate this value and insert into the object?
public Baukloetze Eichen = new Baukloetze(1.2, 800d, masse); public Baukloetze Fichten = new Baukloetze(1.2, 500d, masse); public Baukloetze Granit = new Baukloetze(1.2, 2800d, masse); public Baukloetze Stahl = new Baukloetze(1.2, 7900d, masse); public double volume, dichte, masse; public Baukloetze(double volume, double dichte, double masse) { this.dichte = dichte; this.volume = 1.2; this.masse = masse;