/*
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 Programma 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 <iostream>
#include <vector>
#include <string>
#include "preventivo.h"
using namespace std;
Preventivo p;
void menu()
{
cout << "Calcolo del preventivo per auto" << endl;
cout << "1) Scegli il modello" << endl;
cout << "2) Scegli la motorizzazione" << endl;
cout << "3) Stampa preventivo" << endl;
cout << "0) Esci" << endl;
}
void scegliModello()
{
int scelta;
vector <string> modelli = p.getModelli();
for (int i = 0; i< modelli.size(); i++)
cout << i+ 1 << ") " << modelli[i] << endl;
cin >> scelta;
p.setModello(scelta-1);
}
void scegliMotorizzazione()
{
int scelta;
vector <string> motorizzazioni = p.getMotorizzazioni();
for (int i = 0; i< motorizzazioni.size(); i++)
cout << i+ 1 << ") " << motorizzazioni[i] << endl;
cin >> scelta;
p.setMotorizzazione(scelta-1);
}
void stampaPreventivo()
{
cout << p.getRiepilogo() << endl;
cout << "Il preventivo e' di " << p.getPreventivo() << " euro" << endl;
}
int main()
{
int scelta;
do
{
menu();
cin >> scelta;
switch (scelta)
{
case 1:
scegliModello();
break;
case 2:
scegliMotorizzazione();
break;
case 3:
stampaPreventivo();
break;
}
}
while (scelta != 0);
return 0;
}