Created
September 9, 2023 04:56
-
-
Save SebastianCastilloDev/b7cfbec50fd660a2dfef038e1433d060 to your computer and use it in GitHub Desktop.
Evaluacion Dicom ejercicio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Console.WriteLine("-------------"); | |
Console.WriteLine("Ingrese rut del cliente a consultar."); | |
Console.WriteLine("-------------"); | |
string rut = Console.ReadLine(); | |
PosibleCliente posibleCliente = new PosibleCliente(rut); | |
posibleCliente.Evaluacion(); | |
public class PosibleCliente{ | |
private string rut; | |
private bool dicom; | |
private int saldoCuenta; | |
public PosibleCliente(string _rut) { | |
rut = _rut; | |
dicom = false; | |
saldoCuenta = 0; | |
} | |
public void Evaluacion() { | |
bool tieneDicom = ConsultarDicom(); | |
int saldoCuenta = ConsultarSaldoCuenta(); | |
string resultadoEvaluacion; | |
Console.WriteLine(ToString()); | |
Thread.Sleep(1000); | |
if(!tieneDicom && saldoCuenta>400000) { | |
resultadoEvaluacion = "Saldo en la cuenta:\t" + saldoCuenta + "\n"; | |
resultadoEvaluacion += "Tiene Dicom:\t\t" + "NO" + "\n\n"; | |
resultadoEvaluacion += "Cliente apto para obtener cuenta corriente\n"; | |
} else { | |
resultadoEvaluacion = "Saldo en la cuenta:\t" + saldoCuenta + "\n"; | |
resultadoEvaluacion += "Tiene Dicom:\t\t" + "SI" + "\n\n"; | |
resultadoEvaluacion += "Cliente no aplica para el producto"; | |
} | |
Console.WriteLine(resultadoEvaluacion); | |
} | |
public bool ConsultarDicom() { | |
Random random = new Random(); | |
int numero = random.Next(1,3); | |
if (numero == 1) { | |
dicom = true; | |
return true; | |
} | |
else return false; | |
} | |
public int ConsultarSaldoCuenta() { | |
Random random = new Random(); | |
int numero = random.Next(200000, 700001); | |
saldoCuenta = numero; | |
return numero; | |
} | |
public bool Dicom { get { | |
return dicom; | |
} | |
} | |
public int SaldoCuenta { | |
get { | |
return saldoCuenta; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment