6 kyu

Coffee machine

Description:

Your company decided to buy a CoffeeMachine from a CoffeeMachineFactory.

After some time your boss starts to suspect that employees are not drinking the coffee from the machine. So you are asked to find a way and improve the machine to track how much coffees were taken from the machine. And as your boss likes statistics he would also like to know how much of each kind of coffee the machine produced.

So here you are - one on one with CoffeeMachine:

public interface CoffeeMachine {
    Coffee makeCoffee();
}

which produces coffees:

public class Coffee {
    //...
    public final String getType() {
        return type;
    }
}

bought from CoffeMachineFactory:

public class CoffeeMachineFactory {
    public static CoffeeMachine buyCoffeeMachine() {
        ....
    }
}

Can you figure it out?

Puzzles
Fundamentals

Stats:

CreatedAug 1, 2017
PublishedAug 1, 2017
Warriors Trained652
Total Skips43
Total Code Submissions645
Total Times Completed168
Java Completions168
Total Stars16
% of votes with a positive feedback rating91% of 43
Total "Very Satisfied" Votes37
Total "Somewhat Satisfied" Votes4
Total "Not Satisfied" Votes2
Total Rank Assessments6
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • marko-bekhta Avatar
  • Madjosz Avatar
  • ZED.CWT Avatar
Ad