Smoothie de frutas

Published by persolut in

Crie uma classe Smoothie e faça o seguinte:

  • Crie uma propriedade chamada Ingredients.
  • Crie um método GetCost que calcula o custo total dos ingredientes usados para preparar o smoothie.
  • Crie um método GetPrice que retorna o valor de GetCost mais o valor de GetCost multiplicado por 1.5. Arredonde para duas casas decimais.
  • Crie um método GetName que obtém os ingredientes e os coloca em ordem alfabética em uma frase descritiva agradável. Se houver vários ingredientes, adicione a palavra "Fusion" ao final; caso contrário, adicione "Smoothie". Lembre-se de trocar "-berries" por "-berry". Veja os exemplos abaixo.
IngredientePreço
Strawberries£1.50
Banana£0.50
Mango£2.50
Blueberries£1.00
Raspberries£1.00
Apple£1.75
Pineapple£3.50

Exemplos

s1 = Smoothie(new string[] { "Banana" })

s1.Ingredients ➞ { "Banana" }

s1.GetCost() ➞ "£0.50"

s1.GetPrice() ➞ "£1.25"

s1.GetName() ➞ "Banana Smoothie"
s2 = Smoothie(new string[] { "Raspberries", "Strawberries", "Blueberries" })
s2.ingredients ➞ { "Raspberries", "Strawberries", "Blueberries" }

s2.GetCost() ➞ "£3.50"

s2.GetPrice() ➞ "£8.75"

s2.GetName() ➞ "Blueberry Raspberry Strawberry Fusion"

Observações

Confira a aba Recursos para relembrar as classes.