exercise finished
This commit is contained in:
17
TicketSystem/Tickets/Adult.cs
Normal file
17
TicketSystem/Tickets/Adult.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
TicketSystem/Tickets/Child.cs
Normal file
17
TicketSystem/Tickets/Child.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
TicketSystem/Tickets/Student.cs
Normal file
17
TicketSystem/Tickets/Student.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
TicketSystem/Tickets/Ticket.cs
Normal file
15
TicketSystem/Tickets/Ticket.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace TicketSystem.Tickets
|
||||
{
|
||||
public enum TicketType
|
||||
{
|
||||
Child,
|
||||
Student,
|
||||
Adult
|
||||
}
|
||||
|
||||
public interface Ticket
|
||||
{
|
||||
int price { get; }
|
||||
int PriceWithReduction();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user