/*
Copyright (C) 2013 Alessandro Bugatti (alessandro.bugatti@istruzione.it)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* Classe semplice per gestire la creazione di un preventivo per auto
* \author Alessandro Bugatti
*
* version 0.1
* date Creazione 07/03/2009
* date Ultima modifica 23/10/2013
*
*/
package configuratoreauto;
/**
*
* @author Alessandro Bugatti
*/
public class PreventivoAuto {
private static String modelli[];
private static double valoriModelli[];
private int modelloScelto;
private static String motorizzazioni[];
private static double valoriMotorizzazioni[];
int motorizzazioneScelta;
public PreventivoAuto()
{
modelloScelto = 0;
motorizzazioneScelta = 0;
}
public static void recuperaDati()
{
modelli = new String[3];
modelli[0] = "Modello A";
modelli[1] = "Modello B";
modelli[2] = "Modello C";
valoriModelli = new double[3];
valoriModelli[0] = 10000;
valoriModelli[1] = 12000;
valoriModelli[2] = 14000;
motorizzazioni = new String[4];
motorizzazioni[0] = "1300 Benzina";
motorizzazioni[1] = "1400 Benzina";
motorizzazioni[2] = "1600 Diesel";
motorizzazioni[3] = "1800 Benzina";
valoriMotorizzazioni = new double[4];
valoriMotorizzazioni[0] = 0;
valoriMotorizzazioni[1] = 1200;
valoriMotorizzazioni[2] = 2000;
valoriMotorizzazioni[3] = 2500;
}
public static String[] getModelli()
{
return modelli;
}
public void setModello(int i)
{
modelloScelto = i;
}
public static String[] getMotorizzazioni()
{
return motorizzazioni;
}
public void setMotorizzazione(int i)
{
motorizzazioneScelta = i;
}
String getRiepilogo()
{
String temp;
temp = "La macchina scelta ha i seguenti parametri:\n";
temp += "Modello: " + modelli[modelloScelto] + "\n";
temp += "Motorizzazione: " + motorizzazioni[motorizzazioneScelta] + "\n";
return temp;
}
double getPreventivo()
{
double temp;
temp = valoriModelli[modelloScelto] + valoriMotorizzazioni[motorizzazioneScelta];
return temp;
}
}