-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConferenza.cs
46 lines (45 loc) · 1.22 KB
/
Conferenza.cs
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// See https://aka.ms/new-console-template for more information
public class Conferenza : Evento
{
private string _relatore;
public string Relatore
{
get
{
return _relatore;
}
set
{
if (value == null || value == "")
throw new GestoreEventiException("Il nome del relatore non può essere vuoto");
_relatore = value;
}
}
private double _prezzo;
public double Prezzo
{
get
{
return _prezzo;
}
private set
{
if (value < 0)
throw new GestoreEventiException("Il prezzo deve essere maggiore/uguale di 0");
_prezzo = value;
}
}
public Conferenza(string titolo, DateOnly data, int capienzaMassima, string relatore, double prezzo) : base(titolo, data, capienzaMassima)
{
Relatore = relatore;
Prezzo = prezzo;
}
public override string ToString()
{
return Data + " - " + Titolo + " - " + Relatore + " - " + Prezzo.ToString("0.00") + "$";
}
public override string ToCsv()
{
return Titolo + ";" + Data + ";" + Relatore + ";" + Prezzo.ToString("0.00");
}
}