Initial Commit
This commit is contained in:
52
src/b_bassanetti/Trecce.java
Normal file
52
src/b_bassanetti/Trecce.java
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package b_bassanetti;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author alunno
|
||||
*/
|
||||
public class Trecce {
|
||||
|
||||
int codice;
|
||||
String nome;
|
||||
String forma;
|
||||
String colore;
|
||||
double costo;
|
||||
|
||||
public Trecce(int codice, String nome, String forma, String colore, double costo) {
|
||||
this.codice = codice;
|
||||
this.nome = nome;
|
||||
this.forma = forma;
|
||||
this.colore = colore;
|
||||
this.costo = costo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "Codice: " + this.codice
|
||||
+ "\nNome: " + this.nome
|
||||
+ "\nForma: " + this.forma
|
||||
+ "\nColore: " + this.colore
|
||||
+ "\nCosto: " + this.costo ;
|
||||
}
|
||||
|
||||
public void aggiornaCosto(boolean direzione, double percentuale){ //true = aumenta
|
||||
//false = decrementa
|
||||
if(direzione){
|
||||
this.costo += (this.costo * percentuale) / 100;
|
||||
}else{
|
||||
this.costo -= (this.costo * percentuale) / 100;}
|
||||
}
|
||||
|
||||
public String getColore() {
|
||||
return colore;
|
||||
}
|
||||
|
||||
public double getCosto() {
|
||||
return costo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user