using System;
public class Program
{
/// <summary>
/// Archer with default value of 10 arrows who can shoot arrows.
/// </summary>
public class Archer
/// Current number of arrows.
public int NumOfArrows { get; set; }
/// Creates new instance of archer.
public Archer()
NumOfArrows = 10;
}
/// Method shoot arrow if archers has at least one in NumOfArrows.
public void Shoot()
if (NumOfArrows < 1)
Console.WriteLine("I don't have arrows.");
else
Console.WriteLine("I always hit right in the middle!");
NumOfArrows--;
public static void Main()
/*
- Vytvořte třídu Lucistnik, ktera bude mit vlastnost PocetSipu a metodu Vystrel. PocetSipu muze byt nastaven treba na 10.
- Pokud bude mit dost sipu, napise Vystrel na konzoli text: Vzdy se strefim primo do prostred!
- metoda Vystrel uvnitr s kazdym vystrelem snizi pocet sipu.
- Pokud bude pocet 0, metoda Vystrel vypise "Nemam sipy".
- Napiste program, ktery vytvori lucistnika a vystreli vsechny sipy
*/
Archer jarda = new Archer();
for (int i = jarda.NumOfArrows; i >= 0; i--)
jarda.Shoot();
Console.ReadLine();