Created a point system to be used for prices

This commit is contained in:
2021-10-23 14:42:55 +02:00
parent d72930cb67
commit 4bb26035d6
3 changed files with 74 additions and 38 deletions
@@ -0,0 +1,17 @@
package com.alttd.objects;
import com.alttd.util.Utilities;
public record Price(double price, int points) {
public static Price addPrice(Price one, Price two) {
return (new Price(Utilities.round(one.price() + two.price(), 2), one.points() + two.points()));
}
public double getPrice(int multiplier) {
return (Utilities.round(price * multiplier, 2));
}
public int getPoints(int multiplier) {
return (points * multiplier);
}
}