54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
namespace biblioteca;
|
|
|
|
class Libro {
|
|
string nome;
|
|
double prezzo;
|
|
string numeroScaffale;
|
|
string numeroPagine;
|
|
string casaEditrice;
|
|
|
|
public Libro(string p_nome, double p_prezzo, string p_numeroScaffale, string p_numeroPagine, string p_casaEditrice) {
|
|
this.nome = p_nome;
|
|
this.prezzo = p_prezzo;
|
|
this.numeroScaffale = p_numeroScaffale;
|
|
this.numeroPagine = p_numeroPagine;
|
|
this.casaEditrice = p_casaEditrice;
|
|
}
|
|
|
|
public string GetNome() {
|
|
return this.nome;
|
|
}
|
|
|
|
public double GetPrezzo() {
|
|
return this.prezzo;
|
|
}
|
|
|
|
public string GetNumeroScaffale() {
|
|
return this.numeroScaffale;
|
|
}
|
|
|
|
public string GetNumeroPagine() {
|
|
return this.numeroPagine;
|
|
}
|
|
|
|
public string GetCasaEditrice() {
|
|
return this.casaEditrice;
|
|
}
|
|
|
|
public void SetPrezzo(double p_prezzo) {
|
|
this.prezzo = p_prezzo;
|
|
}
|
|
|
|
public void StampaLibro() {
|
|
Console.WriteLine($"Nome: {this.GetNome()}");
|
|
Console.WriteLine($"Prezzo: {this.GetPrezzo()}");
|
|
Console.WriteLine($"Numero scaffale: {this.GetNumeroScaffale()}");
|
|
Console.WriteLine($"Numero pagine: {this.GetNumeroPagine()}");
|
|
Console.WriteLine($"Casa editrice: {this.GetCasaEditrice()}");
|
|
}
|
|
|
|
public void ApplicaSconto() {
|
|
const double SCONTO = 0.1;
|
|
this.SetPrezzo(this.GetPrezzo() - this.GetPrezzo() * SCONTO);
|
|
}
|
|
} |