Package no.ntnu.idatt1002.demo.data
Class QuantityUnit
java.lang.Object
no.ntnu.idatt1002.demo.data.QuantityUnit
This class is a simple bean for a quantity unit.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQuantityUnit
(int quantity, String unit) Constructor for the QuantityUnit class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addQuantity
(int additionalQuantity) Adds a quantity to the current quantity.int
Returns the quantity.getUnit()
Returns the unit.toString()
-
Field Details
-
quantity
private int quantity -
unit
-
-
Constructor Details
-
QuantityUnit
Constructor for the QuantityUnit class.- Parameters:
quantity
- the quantityunit
- the unit
-
-
Method Details
-
getQuantity
public int getQuantity()Returns the quantity.- Returns:
- the quantity
-
getUnit
Returns the unit.- Returns:
- the unit
-
addQuantity
public void addQuantity(int additionalQuantity) Adds a quantity to the current quantity.- Parameters:
additionalQuantity
- the additional quantity
-
toString
-