Class QuantityUnit

java.lang.Object
no.ntnu.idatt1002.demo.data.QuantityUnit

public class QuantityUnit extends Object
This class is a simple bean for a quantity unit.
  • Field Details

    • quantity

      private int quantity
    • unit

      private final String unit
  • Constructor Details

    • QuantityUnit

      public QuantityUnit(int quantity, String unit)
      Constructor for the QuantityUnit class.
      Parameters:
      quantity - the quantity
      unit - the unit
  • Method Details

    • getQuantity

      public int getQuantity()
      Returns the quantity.
      Returns:
      the quantity
    • getUnit

      public String 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

      public String toString()
      Overrides:
      toString in class Object