exercise finished

This commit is contained in:
2023-07-01 16:44:08 +02:00
commit 71fb61f6dc
10 changed files with 255 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
namespace TicketSystem.Tickets
{
public class Adult: Ticket
{
public int price { get; }
public Adult()
{
price = 20;
}
public int PriceWithReduction()
{
return price - price/100*20;
}
}
}

View File

@@ -0,0 +1,17 @@
namespace TicketSystem.Tickets
{
public class Child: Ticket
{
public int price { get; }
public Child()
{
price = 5;
}
public int PriceWithReduction()
{
return 2;
}
}
}

View File

@@ -0,0 +1,17 @@
namespace TicketSystem.Tickets
{
public class Student: Ticket
{
public int price { get; }
public Student()
{
price = 10;
}
public int PriceWithReduction()
{
return 10-3;
}
}
}

View File

@@ -0,0 +1,15 @@
namespace TicketSystem.Tickets
{
public enum TicketType
{
Child,
Student,
Adult
}
public interface Ticket
{
int price { get; }
int PriceWithReduction();
}
}