Coverage Summary for Class: GameOverData (io.github.unisim)
| Class |
Method, %
|
Branch, %
|
Line, %
|
| GameOverData |
100%
(4/4)
|
100%
(4/4)
|
100%
(15/15)
|
| GameOverData$1 |
100%
(1/1)
|
100%
(1/1)
|
| Total |
100%
(5/5)
|
100%
(4/4)
|
100%
(16/16)
|
package io.github.unisim;
import io.github.unisim.building.BuildingType;
public class GameOverData {
private int recreation;
private int learning;
private int eating;
private int sleeping;
private int score;
/**
* called at the end of the game to display the number of each building placed
*
* @param building - the building type
* @param amount - the number of buildings placed for each type respectively
*/
public void setBuildings(BuildingType building, int amount) {
switch (building) {
case RECREATION:
recreation = amount;
break;
case SLEEPING:
sleeping = amount;
break;
case EATING:
eating = amount;
break;
case LEARNING:
learning = amount;
break;
default:
break;
}
}
public String getData() {
String output = "Recreation = " + recreation + "\nLearning = " + learning + "\nSleeping = " + sleeping
+ "\nEating = " + eating + "\nScore: " + score;
return output;
}
public void setScore(int score) {
this.score = score;
}
}