#include <stdlib.h>
#include <iostream>
using std::cerr;
using std::cin;
using std::cout;
using std::cout;
using std::endl;
using std::ios;
using std::fixed;
using std::left;
using std::right;
using std::showpoint;
#include <fstream>
using std::ofstream;
using std::ifstream;
#include <cstdlib>
using std::exit;
#include <iomanip>
using std::setw;
using std::setprecision;
#include <string>
using std::string;
#define sueldoIng = 7500000
#define sueldoOpe = 5000000
#define sueldoDis = 6000000
#define sueldoObr = 2500000
using namespace std;
int sueldoTotalEmpleado(int horasOrdinarias, int horasExtras)
{
int netoaPagar;
netoaPagar=horasExtras*sueldoDis+horasOrdinarias*sueldoDis;
return netoaPagar;
}
void MenuEmpleado ()
{
int opc, codigo, tipoEmpleado, horasOrdinarias, horasExtras;
int netoaPagar;
char nombre[30];
int MenuPrincipal();
int reinicioPrograma();
ofstream archivoClientesSalida( "clientes.dat", ios::app );
if ( !archivoClientesSalida )
{
cerr << "FALLO CARGA DEL ARCHIVO" << endl;
exit(1);
}
do
{
cout << endl << endl;
cout << " INGRESE DATOS DEL EMPLEADO" << endl;
cout << " INGRESE CODIGO ";
cin >> codigo;
cout << " INGRESE NOMBRE ";
cin >> nombre;
cout << " TIPO DE EMPLEADO ";
cin >> tipoEmpleado;
cout << " HORAS ORDINARIAS ";
cin >> horasOrdinarias;
cout << " HORAS EXTRAS ";
cin >> horasExtras;
archivoClientesSalida << codigo << "\t" << nombre << "\t\t" << tipoEmpleado
<< "\t" << horasOrdinarias << "\t" << horasExtras << endl;
cout << endl << endl;
cout << " 1. SALARIO SEGUN TRABAJO" << endl;
cout << " 2. INGRESAR OTRO EMPLEADO" << endl;
cout << " 3. SALIR DEL REGISTRO " << endl << endl;
cout << " INGRESE DATO VALIDO ";
cin >> opc;
if (opc==1)
{
netoaPagar = sueldoTotalEmpleado(horasOrdinarias, horasExtras);
cout << " EL SALARIO DEL EMPLEADO EQUIVALE A " << netoaPagar;
}
if (opc <1 || opc>3)
{
reinicioPrograma();
}
system("cls");
}
while (opc!=3);
}
int MenuUsuario()
{
int OpcUsuario;
int definirSueldo();
int MenuPrincipal();
int maquinasAlquiler();
int compraMateriales();
int reinicioPrograma();
cout << endl << endl;
cout << " SELECCIONE UNA OPCION PARA CONTINUAR" << endl << endl;
cout << " 1. ALQUILER DE MAQUINARIA" << endl;
cout << " 2. COMPRA DE MATERIALES" << endl << endl;
cout << " INGRESE UNA OPCION VALIDA\t";
cin >> OpcUsuario;
if (OpcUsuario == 1)
{
system("cls");
maquinasAlquiler();
}
else if (OpcUsuario == 2)
{
system("cls");
compraMateriales();
}
else
{
reinicioPrograma();
}
return 0;
}
int reinicioPrograma()
{
int MenuPrincipal();
cout << endl << endl;
cerr << "Dato invalido, para continuar " << endl;
cerr << " presione ENTER/INTRO ";
getchar();
getchar();
system("cls");
MenuPrincipal();
return 0;
}
int maquinasAlquiler()
{
cout << "MAQUINAS DISPONIBLES" << endl << endl;
cout << "1. Bobcat" << endl;
cout << "2. Bulldozer" << endl;
cout << "3. Komatzu Limited" << endl;
cout << "4. MARAIS" << endl;
cout << "5. Pala excavadora" << endl;
cout << "6. Topadora" << endl;
cout << "7. Tuneladora" << endl;
cout << "8. Zanjadora" << endl;
cout << "9. Camion de Pluma" << endl;
int opcMaq;
cout << "SELECCIONE UNA OPCION ";
cin >> opcMaq;
return 0;
}
/*
int compraMateriales()
{
}
*/
int MenuPrincipal()
{
cout << endl << endl;
cout << " SELECCIONE UNA OPCION PARA CONTINUAR" << endl << endl;
cout << " 1. EMPLEADO" << endl;
cout << " 2. USUARIO" << endl << endl;
int opcion;
do
{
cout << " INGRESE UNA OPCION VALIDA ";
cin >> opcion;
}
while (opcion<1 or opcion>2);
switch (opcion)
{
case 1:
system("cls");
MenuEmpleado();
break;
case 2:
system("cls");
MenuUsuario();
break;
}
return 0;
}
int main()
{
MenuPrincipal();
}