Coverage Summary for Class: MoneyClass (io.github.unisim)

Class Class, % Method, % Branch, % Line, %
MoneyClass 100% (1/1) 100% (4/4) 100% (2/2) 100% (10/10)


 package io.github.unisim;
 
 /**
  * OOP class to manage money
  */
 public class MoneyClass {
     private int money;
 
     /**
      * Constructor: Initialises the MoneyClass with an initial amount from parameter
      * 
      * @param money - The initial amount of money - Integer
      */
     public MoneyClass(int money) {
         this.money = money;
     }
 
     /**
      * Returns current amount of money
      * 
      * @return - Current money - Integer
      */
     public int getMoney() {
         return this.money;
     }
 
     /**
      * Adds the value given by parameter to the current amount of money
      * 
      * @param value - The amount to add - Integer
      */
     public void addMoney(int value) {
         this.money += value;
     }
 
     /**
      * Removes the value given by parameter from current amount of money
      * 
      * @param value - The amount to remove - Integer
      */
     public void remMoney(int value) {
         this.money -= value;
         if (this.money <= 0) { // Makes sure money doesn't go negative
             this.money = 0;
         }
     }
 }