Coverage Summary for Class: ReputationClass (io.github.unisim)
| Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
| ReputationClass |
100%
(1/1)
|
100%
(4/4)
|
100%
(4/4)
|
100%
(12/12)
|
package io.github.unisim;
/**
* OOP class to manage reputation
*/
public class ReputationClass {
private int Rep;
/**
* Constructor: Initialises the ReputationClass with an initial amount from
* parameter
*
* @param rep - The initial amount of reputation - Integer
*/
public ReputationClass(int rep) {
this.Rep = rep;
}
/**
* Returns current reputation
*
* @return - Current reputation - Integer
*/
public int getRep() {
return this.Rep;
}
/**
* Adds the value given by parameter to current reputation
*
* @param value - The amount to add - Integer
*/
public void addRep(int value) {
this.Rep += value;
if (this.Rep >= 100) {
this.Rep = 100;
}
}
/**
* Removes the value given by parameter from current reputation
*
* @param value - The amount to remove - Integer
*/
public void remRep(int value) {
this.Rep -= value;
if (this.Rep <= 0) {
this.Rep = 0;
}
}
}