Skip to main content
deleted 4 characters in body
Source Link
Gentian Kasa
  • 2.1k
  • 15
  • 24

I'd say that there's a flaw in the logic of the code in the cup :). It should be more like the following IMO:

Cup coffeeCup = new Cup(size);

while(true)
{
    if(cup.IsEmpty)
    {
        cup.Refill(coffeeType);
    }
    
    cup.Drink();
}

That being said, regarding your code, I'd just remove the following lines:

public static Cup SMALL = new Cup(CupSize.Small);
public static Cup MEDIUM = new Cup(CupSize.Medium);
public static Cup LARGE = new Cup(CupSize.Large);
public static Cup EXTRA_LARGE = new Cup(CupSize.ExtraLarge);

as they don't add anything of much relevance IMO.

I'd say that there's a flaw in the logic of the code in the cup :). It should be more like the following IMO:

Cup coffeeCup = new Cup(size);

while(true)
{
    if(cup.IsEmpty)
    {
        cup.Refill(coffeeType);
    }
    
    cup.Drink();
}

That being said, regarding your code, I'd just remove the following lines:

public static Cup SMALL = new Cup(CupSize.Small);
public static Cup MEDIUM = new Cup(CupSize.Medium);
public static Cup LARGE = new Cup(CupSize.Large);
public static Cup EXTRA_LARGE = new Cup(CupSize.ExtraLarge);

as they don't add anything of much relevance IMO.

I'd say that there's a flaw in the logic of the code in the cup :). It should be more like the following:

Cup coffeeCup = new Cup(size);

while(true)
{
    if(cup.IsEmpty)
    {
        cup.Refill(coffeeType);
    }
    
    cup.Drink();
}

That being said, regarding your code, I'd just remove the following lines:

public static Cup SMALL = new Cup(CupSize.Small);
public static Cup MEDIUM = new Cup(CupSize.Medium);
public static Cup LARGE = new Cup(CupSize.Large);
public static Cup EXTRA_LARGE = new Cup(CupSize.ExtraLarge);

as they don't add anything of much relevance IMO.

Source Link
Gentian Kasa
  • 2.1k
  • 15
  • 24

I'd say that there's a flaw in the logic of the code in the cup :). It should be more like the following IMO:

Cup coffeeCup = new Cup(size);

while(true)
{
    if(cup.IsEmpty)
    {
        cup.Refill(coffeeType);
    }
    
    cup.Drink();
}

That being said, regarding your code, I'd just remove the following lines:

public static Cup SMALL = new Cup(CupSize.Small);
public static Cup MEDIUM = new Cup(CupSize.Medium);
public static Cup LARGE = new Cup(CupSize.Large);
public static Cup EXTRA_LARGE = new Cup(CupSize.ExtraLarge);

as they don't add anything of much relevance IMO.