// Path: src/main/java/shopJava/util/Util.java
// public static int average(final int totalAmount, final int orderCount) {
//     return orderCount == 0 ? 0 : Math.round((100.0f * totalAmount / orderCount) / 100);
// }
// 
// Path: src/main/java/shopJava/util/Util.java
// public static int totalAmountOf(final List<Order> orders) {
//     return orders.stream().mapToInt(order -> order.amount).sum();
// }


import java.util.List;
import static shopJava.util.Util.average;
import static shopJava.util.Util.totalAmountOf;
package shopJava.model;



@SuppressWarnings("WeakerAccess")
public class Result {

    public final String username;
    public final int orderCount;
    public final int totalAmount;
    public final int avgAmount;

    public Result(final String username, final int orderCount, final int totalAmount, final int avgAmount) {
        this.username = username;
        this.orderCount = orderCount;
        this.totalAmount = totalAmount;
        this.avgAmount = avgAmount;
    }

    public Result(final String username, final int orderCount, final int totalAmount) {
        this(username, orderCount, totalAmount, average(totalAmount, orderCount));
    }

    public Result(final String username, final List<Order> orders) {
// Path: src/main/java/shopJava/util/Util.java
// public static int average(final int totalAmount, final int orderCount) {
//     return orderCount == 0 ? 0 : Math.round((100.0f * totalAmount / orderCount) / 100);
// }
// 
// Path: src/main/java/shopJava/util/Util.java
// public static int totalAmountOf(final List<Order> orders) {
//     return orders.stream().mapToInt(order -> order.amount).sum();
// }


// Path: src/main/java/shopJava/model/Result.java
import java.util.List;
import static shopJava.util.Util.average;
import static shopJava.util.Util.totalAmountOf;

package shopJava.model;



@SuppressWarnings("WeakerAccess")
public class Result {

    public final String username;
    public final int orderCount;
    public final int totalAmount;
    public final int avgAmount;

    public Result(final String username, final int orderCount, final int totalAmount, final int avgAmount) {
        this.username = username;
        this.orderCount = orderCount;
        this.totalAmount = totalAmount;
        this.avgAmount = avgAmount;
    }

    public Result(final String username, final int orderCount, final int totalAmount) {
        this(username, orderCount, totalAmount, average(totalAmount, orderCount));
    }

    public Result(final String username, final List<Order> orders) {
        this(username, orders.size(), totalAmountOf(orders));