Untitled
unknown
plain_text
a year ago
2.0 kB
7
Indexable
using System.Timers;
namespace Clase3_Ejercicio1
{
internal class Program
{
static void Main(string[] args)
{
Console.Write("Ingrese la categoría (A, B, C, D, E): ");
char categoria = Convert.ToChar(Console.ReadLine().ToUpper());
Console.Write("Ingrese las horas trabajadas en el mes: ");
int horasTrabajadas = Convert.ToInt32(Console.ReadLine());
Console.Write("Ingrese la antigüedad en años: ");
int antiguedad = Convert.ToInt32(Console.ReadLine());
double salarioBase = CalcularSalarioBase(categoria, horasTrabajadas, antiguedad);
Console.WriteLine($"El salario del empleado es: ${salarioBase:N2}");
}
static double CalcularSalarioBase(char categoria, int horasTrabajadas, int antiguedad)
{
double salario = 0;
if (horasTrabajadas >= 160)
{
switch (categoria)
{
case 'A':
case 'B':
salario = 420;
break;
case 'C':
salario = 220;
break;
default:
salario = 120;
break;
}
}
else
{
switch (categoria)
{
case 'A':
case 'B':
salario = 400;
break;
case 'C':
salario = 200;
break;
default:
salario = 100;
break;
}
}
if (antiguedad > 5)
{
salario *= Math.Pow(1.01, antiguedad - 5);
}
return salario;
}
}
}
Editor is loading...
Leave a Comment