/* * 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; } }