/*
Copyright (C) 2008 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.
*/
/*! \file
* \brief Classe per calcolare il preventivo di un'automobile
* \author Alessandro Bugatti
*
* \version 0.1
* \date Creazione 15/04/2009
* \date Ultima modifica 15/04/2009
*
*/
#include "preventivo.h"
Preventivo::Preventivo()
{
modelli.push_back("Modello A");
modelli.push_back("Modello B");
modelli.push_back("Modello C");
valoriModelli.push_back(10000);
valoriModelli.push_back(12000);
valoriModelli.push_back(14000);
modelloScelto = 0;
motorizzazioni.push_back("1300 Benzina");
motorizzazioni.push_back("1400 Benzina");
motorizzazioni.push_back("1600 Diesel");
motorizzazioni.push_back("1800 Benzina");
valoriMotorizzazioni.push_back(0);
valoriMotorizzazioni.push_back(1200);
valoriMotorizzazioni.push_back(2000);
valoriMotorizzazioni.push_back(2500);
motorizzazioneScelta = 0;
colori.push_back("Verde");
colori.push_back("Rosso");
colori.push_back("Giallo");
colori.push_back("Blu");
valoriColori.push_back(0);
valoriColori.push_back(200);
valoriColori.push_back(300);
valoriColori.push_back(350);
coloreScelto = 0;
}
vector <string> Preventivo::getModelli() const
{
return modelli;
}
void Preventivo::setModello(int i)
{
modelloScelto = i;
}
vector <string> Preventivo::getMotorizzazioni() const
{
return motorizzazioni;
}
void Preventivo::setMotorizzazione(int i)
{
motorizzazioneScelta = i;
}
vector <string> Preventivo::getColori() const
{
return colori;
}
void Preventivo::setColore(int i)
{
coloreScelto = i;
}
string Preventivo::getRiepilogo() const
{
string temp;
temp = "La macchina scelta ha i seguenti parametri:\n";
temp += "Modello: " + modelli[modelloScelto] + "\n";
temp += "Motorizzazione: " + motorizzazioni[motorizzazioneScelta] + "\n";
temp += "Colore: " + colori[coloreScelto] + "\n";
return temp;
}
double Preventivo::getPreventivo() const
{
double temp = 0;
temp = valoriModelli[modelloScelto] + valoriMotorizzazioni[motorizzazioneScelta]
+ valoriColori[coloreScelto];
return temp;
}