Migliorie
This commit is contained in:
@@ -35,7 +35,7 @@ public class Prodotto {
|
||||
public float checkQtaDisponibile(String nome, float qtaDaComprare) {
|
||||
float ritorno;
|
||||
if (!this.nome.equals(nome)) {
|
||||
ritorno = 0; // oppure potresti lanciare un'eccezione
|
||||
ritorno = 0;
|
||||
}
|
||||
|
||||
if (this.qta >= qtaDaComprare) {
|
||||
@@ -47,8 +47,10 @@ public class Prodotto {
|
||||
return ritorno;
|
||||
}
|
||||
|
||||
public void updQtaMagazzino(String nome, float qtaFinale) {
|
||||
|
||||
public void updQtaMagazzino(String nome, float qtaFinale) { // decreaseQuantity
|
||||
if (this.nome.equals(nome)) {
|
||||
this.qta = qtaFinale;
|
||||
}
|
||||
}
|
||||
|
||||
public void applicaSconto() {
|
||||
@@ -59,10 +61,6 @@ public class Prodotto {
|
||||
return this.qta;
|
||||
}
|
||||
|
||||
public void decreaseQuantity(float p_qta) {
|
||||
this.qta -= p_qta;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return this.nome;
|
||||
}
|
||||
@@ -70,4 +68,8 @@ public class Prodotto {
|
||||
public float getPrezzo() {
|
||||
return this.prezzo;
|
||||
}
|
||||
|
||||
public void invalida() {
|
||||
this.nome = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user