-
Notifications
You must be signed in to change notification settings - Fork 0
/
CarroLuxo.cs
52 lines (47 loc) · 1.65 KB
/
CarroLuxo.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
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AutoAluga
{
class CarroLuxo : Viatura
{
private float txLuxo;
public CarroLuxo(String Matricula, float Taxa) : base(Matricula)
{
txLuxo = Taxa;
}
public override int RegistarAluguel(Cliente ClienteX, int Dias)
{
if (GetPrecoDia() == 0)
{
Aluguer X = new Aluguer(++IdAluguer, Dias, 0, ClienteX, this);
ViAlugueresHist.Add(X);
ClienteX.AddAluguer(X);
StatusChange();
return IdAluguer;
}
else
{
Aluguer X = new Aluguer(++IdAluguer, Dias, (GetPrecoDia() + ((GetPrecoDia() * txLuxo) / 100)) * Dias, ClienteX, this);
ViAlugueresHist.Add(X);
ClienteX.AddAluguer(X);
StatusChange();
AutoAluga.AtualTot((GetPrecoDia() + ((GetPrecoDia() * txLuxo) / 100))*Dias);
return IdAluguer;
}
}
public override void Print()
{
Console.WriteLine(":::Carro de Luxo:::");
base.Print();
Console.WriteLine("Taxa: " + txLuxo + "%");
Console.WriteLine("Preço Total: " + (GetPrecoDia()+((GetPrecoDia()*txLuxo)/100)) + "Eur");
Console.WriteLine("Total Facturado: " + GetTotalFacturado() + "Eur");
}
~CarroLuxo()
{
Console.WriteLine("Registo do Carro de Luxo com Matricula \"" + GetMatricula() + "\" apagado.");
}
}
}