Files
oopuebung/uebung07/src/quantities/generic/LengthUnit.java
2025-06-04 18:27:10 +02:00

20 lines
744 B
Java

package quantities.generic;
public class LengthUnit extends Unit<Length> {
public LengthUnit(String name, double baseFactor) {
super(name, baseFactor);
}
public static final LengthUnit METER = new LengthUnit("m", 1);
public static final LengthUnit MILLIMETER = new LengthUnit("mm", 0.001);
public static final LengthUnit KILOMETER = new LengthUnit("km", 1000);
public static final LengthUnit MILE = new LengthUnit("mi", 1609.344);
public static final LengthUnit LIGHTYEAR = new LengthUnit("ly", 9460730472580800.0);
public static final LengthUnit PARSEC = new LengthUnit("pc", 3.0856776e16);
@Override
public Length quantity(double value) {
return new Length(value, this);
}
}