-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuItem.cs
More file actions
29 lines (23 loc) · 802 Bytes
/
MenuItem.cs
File metadata and controls
29 lines (23 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespace SDP_Project;
public abstract class MenuItem : MenuComponent
{
public required string Name { get; set; }
public required string Description { get; set; }
public required double BasePrice { get; set; }
public double Discount { get; set; } = 0;
public double Price => BasePrice - Discount;
public bool HasSpecialOffer => Discount > 0;
public abstract void Prepare();
public abstract void Cook();
public abstract void Pack();
public abstract List<Type> GetAvailableDecorators();
public override string ToString()
{
if (HasSpecialOffer)return $"{Name}, {Price:C} (U.P. {BasePrice:C})";
return $"{Name}, ${Price:0.00}";
}
public override Iterator CreateIterator()
{
return new NullIterator();
}
}