Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

PRIMER CORTE

Nomina
CLASS CALCULODELANOMINA
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;

namespace PrimerCorte
{
internal class calculodelanomina
{
private int ns, nd, nhed, nhen, st, sm;
private double dt, hed, hen, tdev, depst, dpt, tdes, depse, dpe, np;
public calculodelanomina(int ns, int nd, int nhed, int nhen, int st, int sm)
{
this.ns = ns;
this.nd = nd;
this.nhed = nhed;
this.nhen = nhen;
this.st = st;
this.sm = sm;

}
public calculodelanomina( double dt, double hed, double hen, double tdev, double depst, double dpt,
double tdes, double depse, double dpe, double np)
{

this.dt = dt;
this.hed = hed;
this.hen = hen;
this.tdev = tdev;
this.depst = depst;
this.dpt = dpt;
this.tdes = tdes;
this.depse = depse;
this.dpe = dpe;
this.np = np;
}

public calculodelanomina()
{
}

public void calcularnominaempleado()


{
WriteLine(" Ingrese cuantos salarios minimos gana en 1 mes ");
ns = ValidaEntero(ns);
WriteLine(" Ingrese cuantos dias extra trabajo ");
nd = ValidaEntero(nd);
WriteLine(" Ingrese cuantas horas extras diurnas trabajo ");
nhed = ValidaEntero(nhed);
WriteLine(" Ingrese cuantas horas extras nocturnas trabajo ");
nhen = ValidaEntero(nhen);
st = 117172;
sm = (1000000 * ns);
dt = ((1000000 * 24) / 720) * nd;
hed = (1000000 / 720) * nhed;
hen = (1000000 / 720) * nhen;
tdev = (sm + dt + hed + hen + st);
depst = ((sm * 0.7) * 0.04);
dpt = ((sm * 0.7) * 0.04);
tdes = (depst + dpt);
np = (tdev - tdes);
WriteLine(" El valor neto a pagar es de: $ " + np);
}
public void calcularnominaempleador()
{
WriteLine(" Ingrese cuantos salarios minimos gana en 1 mes ");
ns = ValidaEntero(ns);
WriteLine(" Ingrese cuantos dias extra trabajo ");
nd = ValidaEntero(nd);
WriteLine(" Ingrese cuantas horas extras diurnas trabajo ");
nhed = ValidaEntero(nhed);
WriteLine(" Ingrese cuantas horas extras nocturnas trabajo ");
nhen = ValidaEntero(nhen);
st = 117172;
sm = (1000000 * ns);
dt = ((1000000 * 24) / 720) * nd;
hed = (1000000 / 720) * nhed;
hen = (1000000 / 720) * nhen;
tdev = (sm + dt + hed + hen + st);
depse = ((sm * 0.7) * 0.085);
dpe = ((sm * 0.7) * 0.12);
tdes = (depse + dpe);
np = (tdev - tdes);
WriteLine(" El valor neto a pagar es de: $ " + np);
}
static int ValidaEntero(int Numero)
{
bool esNumero = true;
do
{
WriteLine(" Digite un número ");
esNumero = int.TryParse(ReadLine(), out Numero);
if (!esNumero)
WriteLine(" Debe digitar un número ");
} while (!esNumero);
return Numero;
}

}
}
PROGRAM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace PrimerCorte
{
internal class Program
{
static void Main(string[] args)
{

string Nombres, Apellidos;


int Opc = 0, CC = 0;
calculodelanomina nomina = new calculodelanomina();
do
{
WriteLine(" Eres un empleado o empleador ");
WriteLine("");
WriteLine(" Digite una opción ");
WriteLine("");
WriteLine(" 1. Empleado ");
WriteLine(" 2. Empleador ");
WriteLine(" 3. Salir ");
Opc = ValidaEntero(Opc);
switch (Opc)
{
case 1:
nomina.calcularnominaempleado();
break;
case 2:
nomina.calcularnominaempleador();
break;
case 3:
WriteLine(" Gracias por utiizar este software ");
ReadKey();
Environment.Exit(0);
break;
default:
WriteLine(" Debe digitar 1 o 2 ");
ReadKey();
Clear();
break;
}
} while (Opc > 0 || Opc < 3);
ReadKey();
}
static int ValidaEntero(int Numero)
{
bool esNumero = true;
do
{
WriteLine(" Digite un número ");
esNumero = int.TryParse(ReadLine(), out Numero);
if (!esNumero)
WriteLine(" Debe digitar un número ");
} while (!esNumero);
return Numero;
}
}

You might also like