Migliorie

This commit is contained in:
La Programmatrice Verde
2025-10-21 21:26:32 +02:00
parent 38d850ccc8
commit 597612352a
3 changed files with 32 additions and 16 deletions

View File

@@ -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;
}
}