Sei sulla pagina 1di 19

FASE 5 – PRODUCTO FINAL

PRESENTADO POR:

LEONARDO BETANCUR DUQUE

CODIGO: 1017125414

TUTOR:

MIRIAN DEL CARMEN BENAVIDES

CURSO:

INTRODUCCION A LA PROGRAMACION

GRUPO: 301304_82

UNIVERSIDAD NACIONAL ABIERTA Y A DISTANCIA

MEDELLIN

22 DE MAYO DEL 2019


INTRODUCCION

El lenguaje de programación C es uno de los más utilizados (si no el que más) en la programación

de sistemas software. Es similar a Python en muchos aspectos fundamentales: presenta las mismas

estructuras de control (selección condicional, iteración), permite trabajar con algunos tipos de datos

similares (enteros, flotantes, secuencias), hace posible definir y usar funciones, etc. No obstante,

en muchas otras cuestiones es un lenguaje muy diferente. C presenta ciertas características que

permiten ejercer un elevado control sobre la eficiencia de los programas, tanto en la velocidad de

ejecución como en el consumo de memoria, pero a un precio: tenemos que proporcionar

información explícita sobre gran cantidad de detalles, aumentando así la probabilidad de que

cometamos errores.
TABLA DE REQUERIMIENTOS

Requerimientos Descripción Entradas Resultados de


salida
R1 el software Capturar a Número de id.
debe tener una usuarios que Nombre
opción para deseen ser Salario
registrar usuarios evaluados Fecha de ingreso
Años de trabajo
Nivel de formación

R2 El software debe Debe imprimir a los Aprobación de la


tener una opción usuarios que capacitación que se
para evaluar si el cumplen con los quiere acceder
usuario cumple con requisitos
los requisitos estipulados

DISEÑO DE CLASES

Clase Atributos
AtributosEmpleados
int identificacion;
string nombre;
int sueldo;
string nivelFormación;
int antiguedad;
double porcentajeReconocimiento;
string postgrado;
string fecha;
class registro atributosEmpleados[] registros;
int contador;
int contadorMax;
CODIGO

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tecer_taller_2019_problema_2
{
class atributosEmpleados
{
int identificacion;
string nombre;
int sueldo;
string nivelFormación;
int antiguedad;
double porcentajeReconocimiento;
string postgrado;
string fecha;

public atributosEmpleados(int identificacion, string nombre, int sueldo, string nivelFormación, int
antiguedad, double porcentajeReconocimiento, string postgrado, string fecha)
{
this.identificacion = identificacion;
this.nombre = nombre;
this.sueldo = sueldo;
this.nivelFormación = nivelFormación;
this.antiguedad = antiguedad;
this.porcentajeReconocimiento = porcentajeReconocimiento;
this.postgrado = postgrado;
this.fecha = fecha;
}
public string getFecha()
{
return fecha;
}

public string getPostgrado()


{
return postgrado;
}

public double getPorcentajeReconocimiento()


{
return porcentajeReconocimiento;
}

public int getSueldo()


{

return sueldo;
}

public int getIdentificacion()


{

return identificacion;
}

public string getNombre()


{

return nombre;
}
public string getNivelFormación()
{

return nivelFormación;
}

public int getAntiguedad()


{

return antiguedad;
}

public String toString()


{
string msj = "\n=================\n";

msj += "\nNúmero de identificación del trabajador: " + this.identificacion;


msj += "\nNombre del trabajador: " + this.nombre;
msj += "\nSalario devengado: " + this.sueldo;
msj += "\nNivel de formación: " + this.nivelFormación;
msj += "\nPorcentaje de reconocimiento adquirido: " + this.porcentajeReconocimiento;
msj += "\nPostgrado: " + this.postgrado;
msj += "\nFecha de ingreso : " + this.fecha;
msj += "\nAntiguedad de: " + this.antiguedad + " Años ";
if (this.antiguedad <= 5)
{
msj += "\n¡LO SENTIMOS NO CUMPLES CON LOS REQUISITOS!:";
}

return msj;

}
class registro
{
atributosEmpleados[] registros;
int contador;
int contadorMax;

public registro(int contadorMax)


{
this.contador = 0;
this.contadorMax = contadorMax;
this.registros = new atributosEmpleados[contadorMax];
}

public void agregar(int identificacion, string nombre, int sueldo, string nivelFormación, int
antiguedad, double porcentajeReconocimiento, string postgrado, string fecha)
{
registros[contador] = new atributosEmpleados(identificacion, nombre, sueldo, nivelFormación,
antiguedad, porcentajeReconocimiento, postgrado, fecha);
contador++;
}

public int buscar(int identificacion) // Con esto aseguramos que cada registro ocupe el puesto que
debe pertenercel
{
int bandera = -1;
for (int i = 0; i < contador; i++)
{
if (registros[i].getIdentificacion().Equals(identificacion))
{
bandera = i;
break;
}
}
return bandera;
}
public int evaluar()
{
int evaluar = 0;

for (int i = 0; i < contador; i++)


{
Console.WriteLine("" + registros[i].toString());

return evaluar;
}

public int getContador()


{
return contador;
}
public int getContadorMax()
{
return contadorMax;
}

public void imprimirDatos()


{

for (int i = 0; i < contador; i++)


{
if (contador > 0)
{

Console.WriteLine("" + registros[i].toString());
}

}
}

class Program
{

static registro registros = null;

public static void menu() //Creamos un menu


{
Console.Clear();
Console.WriteLine("Desarrollamos soluciones");
Console.WriteLine("_____________________________");
Console.WriteLine("1.Registrar empleados");
Console.WriteLine("2.Imprimir listado de empleados");
Console.WriteLine("3.salir");
Console.WriteLine("Digite su opción");
}

public static void agregar()


{
if (registros.getContador() < registros.getContadorMax())
{
double porcentaje = 0;
int op;
int opNivelF = 0;
int identificacion = 0;
string nombre = "";
int sueldo = 781242;
string nivelFormación = "";
int antiguedad = 0;
double porcentajeReconocimiento = 0;
string postgrado = "";
string fecha;

Console.WriteLine("Digite el número de su identificación");


identificacion = int.Parse(Console.ReadLine());

int res = registros.buscar(identificacion);


if (res == -1)
{

Console.WriteLine("Digite su nombre");
nombre = (Console.ReadLine());

Console.WriteLine("Digite cuantos salarios minimos devenga");


int cantidadS = int.Parse(Console.ReadLine());

Console.WriteLine("Digite la fecha en la que ingreso a la empresa");


fecha = Console.ReadLine();

Console.WriteLine(" ");

Console.WriteLine("Digite los años que lleva trabajando en la empresa");


antiguedad = int.Parse(Console.ReadLine());
if (antiguedad < 5)
{

Console.WriteLine("Lo sentimos, no cumples con la antiguedad, continue con el


registro");
}

Console.WriteLine(" ");

Console.WriteLine("¿es usted profesional?");


Console.WriteLine("1.Si");
Console.WriteLine("2.No");

opNivelF = int.Parse(Console.ReadLine());
switch (opNivelF)
{
case 1:
nivelFormación = "Profesional";
break;

case 2:
nivelFormación = "No es profesioanl, por lo tanto no puedes acceder al beneficio";
break;
}

Console.WriteLine(" ");
Console.WriteLine("Nivel de formación a la cual puedes acceder");
Console.WriteLine("1.Especialización");
Console.WriteLine("2.Maestria");
Console.WriteLine("3.Doctorado");
Console.WriteLine(" ");
Console.WriteLine("Digite la capacitación a la cual quieres acceder");
op = int.Parse(Console.ReadLine());

switch (op)
{
case 1:
postgrado = "Especialista";
if (cantidadS > 1 && cantidadS < 3)
{
porcentaje = 0.005;

else if (cantidadS > 4 && cantidadS < 7)


{
porcentaje = 0.003;
}

break;

case 2:
postgrado = "Maestria";

if (cantidadS > 1 && cantidadS < 3)


{
porcentaje = 0.10;

else if (cantidadS > 4 && cantidadS < 7)


{
porcentaje = 0.008;
}

break;

case 3:
postgrado = "Doctorado";

if (cantidadS > 1 && cantidadS < 3)


{
porcentaje = 0.15;

else if (cantidadS > 4 && cantidadS < 7)


{
porcentaje = 0.13;
}

break;

}
sueldo = sueldo * cantidadS;
porcentajeReconocimiento = sueldo * porcentaje;

registros.agregar(identificacion, nombre, sueldo, nivelFormación, antiguedad,


porcentajeReconocimiento, postgrado, fecha);
Console.WriteLine("Registro agregado");

else
{
Console.WriteLine("El registro ya se encuetra agregado");
}

else
{
Console.WriteLine("Capacidad Excedida");
}

static void Main(string[] args)


{
int op;
registros = new registro(2);

do
{
menu();

op = int.Parse(Console.ReadLine());

switch (op)
{
case 1:
Console.Clear();
agregar();
Console.ReadLine();
break;

case 2:
Console.Clear();
Console.WriteLine("Información de los trabajadores");
registros.evaluar();
Console.ReadLine();
break;
}

} while (op != 3);

}
}

}
OPERACIONES BASICAS

1. Abrir un nuevo Proyecto

2. Seleccione Aplicación de Consola

3. CODIGO

using System;
using System.Collections.Generic;
using System.Linq;
using System. Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int NUM1, NUM2, RESUL;
string linea;
Console.Write("PRIMER NÚMERO :");
linea = Console.ReadLine();
NUM1 = int.Parse(linea);
Console.Write("SEGUNDO NÚMERO :");
linea = Console.ReadLine();
NUM2 = int.Parse(linea);
Console.WriteLine();
RESUL = NUM1 + NUM2;
Console.WriteLine("LA SUMA ES {0}: ", RESUL);
RESUL = NUM1 - NUM2;
Console.WriteLine("LA RESTA ES: {0} - {1} = {2} ", NUM1, NUM2, RESUL);
RESUL = NUM1 * NUM2;
Console.WriteLine("LA MULTIPLICACIÓN ES: " + RESUL);
RESUL = NUM1 / NUM2;
Console.WriteLine("LA DIVISIÓN ES: " + RESUL);
RESUL = NUM1 % NUM2;
Console.WriteLine("EL RESIDUO ES: " + RESUL);
Console.Write("Pulse una Tecla:"); Console.ReadLine();
}

4. GRABAR Y EJECURTAR

COMPRA EN RESTAURANTE

1. Abri un Nuevo proyecto


2. Seleccione aplicacion de consola
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{ class Program
{ static void Main(string[] args)
{
byte CANB, CANH, CANP;
double APAGAR;
string linea;
const double PRECIOB = 0.8;
const double PRECIOH = 2;
const double PRECIOP = 1.2;
Console.Write("CANTIDAD DE HAMBURGUESAS :");linea = Console.ReadLine();
CANH = byte.Parse (linea);
Console.Write("CANTIDAD DE PAPAS :");linea = Console.ReadLine();
CANP = byte.Parse (linea);
Console.Write("CANTIDAD DE BEBIDAS :");linea = Console.ReadLine();
CANB = byte.Parse (linea);
Console.WriteLine();
APAGAR = (CANH * PRECIOH) + (CANP * PRECIOP) + (CANB * PRECIOB);
Console.WriteLine("VALOR A PAGAR: " + APAGAR);
Console.Write("Pulse una Tecla:");Console.ReadLine();
}
}
}

Grabar y ejecutar
FORMATOS DE SALIDA

CODIGO:

using System.Text;
namespace ConsoleApplication1
{ class Program
{ static void Main(string[] args)
{ double BASE, ALTURA, RESUL;
string linea;
Console.Write("DIGITE LA BASE :"); linea = Console.ReadLine();
BASE = double.Parse (linea);
Console.Write("DIGITE LA ALTURA:"); linea = Console.ReadLine();
ALTURA= double.Parse (linea);
RESUL = (BASE * ALTURA) / 2;
Console.WriteLine("AREA TRIANGULO :" + String.Format("{0:####.00}", RESUL));
Console.WriteLine("AREA TRIANGULO :" + String.Format("{0:c}", RESUL));
Console.WriteLine("AREA TRIANGULO :" + String.Format("{0:f}", RESUL));
Console.WriteLine("AREA TRIANGULO :" + String.Format("{0:g}", RESUL));
Console.WriteLine();
Console.WriteLine("HOY ES: " + String.Format("Hoy es {0:F}", DateTime.Now));
Console.WriteLine("HOY ES: " + String.Format("Hoy es {0:dddd}{0:dd/MM/yyy}",
DateTime.Now));
Console.Write("Pulse una Tecla:"); Console.ReadLine();
}
}
}

Grabar y ejecutar
Bibliografias

https://www.mheducation.es/bcv/guide/capitulo/8448147227.pdf

Benavides, M. (2018). Pasos previos a la codificación de un programa. [Video] Recuperado

de http://hdl.handle.net/10596/22351

Ceballos, S. F. J. (2007). Microsoft C#: lenguaje y aplicaciones (2a. ed.). (pp. 161 - 204). Madrid,
ES: RA-MA Editorial. Recuperado
dehttp://bibliotecavirtual.unad.edu.co:2077/lib/unadsp/reader.action?docID=11046613&ppg=183
OVI Unidad 3 Arreglos
Benavides, M. (2016). Arreglos. [Video] Recuperado dehttp://hdl.handle.net/10596/10402

Potrebbero piacerti anche