Está en la página 1de 5

UNIVERSIDAD PRIVADA DEL VALLE

FACULTAD DE INFORMATICA Y ELECTRONICA


INGENIERÍA DE SISTEMAS INFORMÁTICOS
SUBSEDE LA PAZ

Materia:
PROGRAMACION II

laboratorio # I

Estudiante:

 Miguel Angel Mollericona Cuentas

Docente: Roxana Laurel Rodriguez

La Paz, 27 de agosto del 2021


Gestión II – 2021
UNIVERSIDAD PRIVADA DEL VALLE
FACULTAD DE INFORMATICA Y ELECTRONICA
INGENIERÍA DE SISTEMAS INFORMÁTICOS
SUBSEDE LA PAZ

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

namespace tarea
{
class Program
{
static void Main(string[] args)
{
CCuenta cuenta01 = new CCuenta();
cuenta01.Nombre = "Juanito alcachofa";
cuenta01.Cuenta = "10000041804720"; //mi número de cuenta para donaciones no sea
mala Lic.
cuenta01.TipoDeInteres = 3.0;
cuenta01.ingreso(100000);
cuenta01.reintegro(30000);
Console.WriteLine("Nombre: "+cuenta01.Nombre+"\n");
Console.WriteLine("Cuenta: "+cuenta01.Cuenta + "\n");
Console.WriteLine("Tipo de interes: "+cuenta01.Saldo + "\n");
Console.WriteLine("Ingreso: "+cuenta01.TipoDeInteres + "\n");

Console.ReadKey();
}
}
class CCuenta
{
private string name;
private string account;
private double saldo;
private double tipoDeInteres;

public string Nombre


{
get { return name; }
set {
if (value.Length == 0)
{
Console.WriteLine("Error: Espacio vacio");
return;
}
name = value;
}
}
UNIVERSIDAD PRIVADA DEL VALLE
FACULTAD DE INFORMATICA Y ELECTRONICA
INGENIERÍA DE SISTEMAS INFORMÁTICOS
SUBSEDE LA PAZ

public string Cuenta


{
get { return account; }
set
{
if (value.Length == 0)
{
Console.WriteLine("Alerta: cuenta no valida");
return;
}
account = value;
}
}
public double Saldo
{
get { return saldo; }
}
public double TipoDeInteres
{
get { return tipoDeInteres; }
set
{
if (value < 0)
{
Console.WriteLine("Error: tipo no valido");
return;
}
tipoDeInteres = value;
}
}
public CCuenta() { }
public CCuenta(string nom, string cue, double sal, double tipo)
{
Nombre = nom;
Cuenta = cue;
ingreso(sal);
TipoDeInteres = tipo;
}
public void ingreso(double cantidad)
{
if (cantidad < 0)
{
Console.WriteLine("Error: cantidad congelada osea bajo cero");
return;
}
saldo = saldo + cantidad;
}
public void reintegro(double cantidad)
{
if (saldo - cantidad < 8)
{
Console.WriteLine("Error: eres pobre");
return;
}
UNIVERSIDAD PRIVADA DEL VALLE
FACULTAD DE INFORMATICA Y ELECTRONICA
INGENIERÍA DE SISTEMAS INFORMÁTICOS
SUBSEDE LA PAZ

saldo = saldo - cantidad;


}
}
}
UNIVERSIDAD PRIVADA DEL VALLE
FACULTAD DE INFORMATICA Y ELECTRONICA
INGENIERÍA DE SISTEMAS INFORMÁTICOS
SUBSEDE LA PAZ

También podría gustarte