NicolasNR

Problema16

Jun 26th, 2019
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.38 KB | None | 0 0
  1. /*
  2. Una empresa ofrece autos bajo las siguientes condiciones: Si los ingresos del comprador son menores de $8000,
  3.     el enganche será del 15% del costo del auto y el resto se distribuirá en pagos mensuales a pagar en 5 años.
  4.     Si los ingresos del comprador son mayores de $8000, el enganche será del 30% del costo del auto y el resto se
  5.     distribuirá en pagos mensuales a pagar en 2 años. Se requiere saber cuánto debe pagar un comprador por concepto de
  6.     enganche y cuánto por cada pago mensual.  Mostrar un menú para elegir alguno de los autos siguientes:
  7.     AUTO        COSTO
  8.     1. Matiz        $89,990.00
  9.     2. Chevy 3 puertas      $102,900.00
  10.     3. Spark        $121,400.00
  11.     4. Chevy sedan      $123,100.00
  12.     5. Aveo         $143,800.00*/
  13.  
  14.  
  15. #include<iostream>
  16. #include<iomanip>
  17.  
  18. using namespace std;
  19.  
  20. int main()
  21. {
  22.  
  23.     cout << fixed << setprecision(2);
  24.     int carro;
  25.     float ingresos, enganche, opc1 = 89990, opc2 = 102900, opc3 = 121400, opc4 = 123100, opc5 = 143800, resto, mensual;
  26.         cout << "\tBienvenido contamos con los siguientes modelos:)" << endl;
  27.         cout << "Auto\t\tCosto" << endl;
  28.         cout << "1. Matiz\t$89,990.00 " << endl;
  29.         cout << "2. Chevy 3 puertas $102,900.00 " << endl;
  30.         cout << "3. Spark\t$121,400.00 " << endl;
  31.         cout << "4. Chevy sedan\t$123,100.00 " << endl;
  32.         cout << "5. Aveo\t\t$143,800.00 " << endl;
  33.         cout << "Introduzca el numero del carro que desea: "; cin >> carro;
  34.         cout << "Cuales son sus ingresos?: "; cin >> ingresos;
  35.  
  36.    
  37.         if (carro == 1)
  38.         {
  39.             if (ingresos >= 8000)
  40.             {
  41.                 enganche = opc1 * 0.30;
  42.                 resto = opc1 - enganche;
  43.                 mensual = resto / 24;
  44.  
  45.                 cout << "Debera pagar 30% de enganche lo cual equivale a: " << enganche << endl;
  46.                 cout << "El resto debera pagar mensualmente: " << mensual << endl;
  47.             }
  48.             else
  49.             {
  50.                 enganche = opc1 * 0.15;
  51.                 resto = opc1 - enganche;
  52.                 mensual = resto / 60;
  53.  
  54.                 cout << "Debera pagar 15% de enganche lo cual equivale a: " << enganche << endl;
  55.                 cout << "El resto debera pagar mensualmente: " << mensual << endl;
  56.             }
  57.         }
  58.         else if (carro == 2)
  59.         {
  60.             if (ingresos >= 8000)
  61.             {
  62.                 enganche = opc2 * 0.30;
  63.                 resto = opc2 - enganche;
  64.                 mensual = resto / 24;
  65.  
  66.                 cout << "Debera pagar 30% de enganche lo cual equivale a: " << enganche << endl;
  67.                 cout << "El resto debera pagar mensualmente: " << mensual << endl;
  68.             }
  69.             else
  70.             {
  71.                 enganche = opc2 * 0.15;
  72.                 resto = opc2 - enganche;
  73.                 mensual = resto / 60;
  74.  
  75.                 cout << "Debera pagar 15% de enganche lo cual equivale a: " << enganche << endl;
  76.                 cout << "El resto debera pagar mensualmente: " << mensual << endl;
  77.             }
  78.         }
  79.         else if (carro == 3)
  80.         {
  81.            
  82.             if (ingresos >= 8000)
  83.             {
  84.                 enganche = opc3 * 0.30;
  85.                 resto = opc3 - enganche;
  86.                 mensual = resto / 24;
  87.  
  88.                 cout << "Debera pagar 30% de enganche lo cual equivale a: " << enganche << endl;
  89.                 cout << "El resto debera pagar mensualmente: " << mensual << endl;
  90.             }
  91.             else
  92.             {
  93.                 enganche = opc3 * 0.15;
  94.                 resto = opc3 - enganche;
  95.                 mensual = resto / 60;
  96.  
  97.                 cout << "Debera pagar 15% de enganche lo cual equivale a: " << enganche << endl;
  98.                 cout << "El resto debera pagar mensualmente: " << mensual << endl;
  99.  
  100.             }
  101.         }
  102.         else if (carro == 4)
  103.         {
  104.             if (ingresos >= 8000)
  105.             {
  106.                 enganche = opc4 * 0.30;
  107.                 resto = opc4 - enganche;
  108.                 mensual = resto / 24;
  109.  
  110.                 cout << "Debera pagar 30% de enganche lo cual equivale a: " << enganche << endl;
  111.                 cout << "El resto debera pagar mensualmente: " << mensual << endl;
  112.             }
  113.             else
  114.             {
  115.                 enganche = opc4 * 0.15;
  116.                 resto = opc4 - enganche;
  117.                 mensual = resto / 60;
  118.  
  119.                 cout << "Debera pagar 15% de enganche lo cual equivale a: " << enganche << endl;
  120.                 cout << "El resto debera pagar mensualmente: " << mensual << endl;
  121.             }
  122.         }
  123.         else if (carro == 5)
  124.         {
  125.             if (ingresos >= 8000)
  126.             {
  127.                 enganche = opc5 * 0.30;
  128.                 resto = opc5 - enganche;
  129.                 mensual = resto / 24;
  130.  
  131.                 cout << "Debera pagar 30% de enganche lo cual equivale a: " << enganche << endl;
  132.                 cout << "El resto debera pagar mensualmente: " << mensual << endl;
  133.             }
  134.             else
  135.             {
  136.                 enganche = opc5 * 0.15;
  137.                 resto = opc5 - enganche;
  138.                 mensual = resto / 60;
  139.  
  140.                 cout << "Debera pagar 15% de enganche lo cual equivale a: " << enganche << endl;
  141.                 cout << "El resto debera pagar mensualmente: " << mensual << endl;
  142.             }
  143.         }
  144.         else
  145.         {
  146.             cout << "Error, introduzca bien los datos" << endl;
  147.         }
  148.     system("pause");
  149. }
Advertisement
Add Comment
Please, Sign In to add comment