Skip to content

Instantly share code, notes, and snippets.

@HugoRoca
Last active May 1, 2022 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HugoRoca/d416c1b827aef763b30f749f52852130 to your computer and use it in GitHub Desktop.
Save HugoRoca/d416c1b827aef763b30f749f52852130 to your computer and use it in GitHub Desktop.
Algoritmo Excercise
Definir messages, serviceNames, quantityServices, customer, brandVehicle, modelVehicle, option, concat, name Como Caracter;
Definir i, j Como Entero;
Definir serviceTime, time, timeTotal Como Real;
Definir allDataIsOk, helper Como Logico;
Dimension serviceNames[6];
serviceNames[1] = "Revision 1000 km";
serviceNames[2] = "Cambio Aceite";
serviceNames[3] = "Revision Frenos";
serviceNames[4] = "Revision Correas";
serviceNames[5] = "Revision Luces";
serviceNames[6] = "Revision direccion";
Dimension serviceTime[6];
serviceTime[1] = 2;
serviceTime[2] = 1;
serviceTime[3] = 0.5;
serviceTime[4] = 0.5;
serviceTime[5] = 0.2;
serviceTime[6] = 0.5;
Escribir "- Ingrese nombre del cliente: ";
Leer customer;
Escribir "- Ingrese marca de vehiculo:";
Leer brandVehicle;
Escribir "- Ingrese modelo del vehiculo:";
Leer modelVehicle;
Escribir "- Ingrese la cantidad de servicios que desea realizar:";
Leer quantityServices;
allDataIsOk = Falso;
helper = Falso;
Mientras allDataIsOk == Falso Hacer
Si ConvertirANumero(quantityServices) > 6 | ConvertirANumero(quantityServices) < 0 Entonces
Escribir "*** DEBE INGRESAR UN OPCION VALIDA ***";
Escribir "- Ingrese la cantidad de servicios que desea realizar:";
Leer quantityServices;
SiNo
Para j = 1 Hasta 6 Hacer
Escribir Concatenar(ConvertirATexto(j), Concatenar(". ", serviceNames[j]));
FinPara
Para i = 1 Hasta ConvertirANumero(quantityServices) Con Paso 1 Hacer
Escribir "- Selecione los servicios: ";
Leer option;
helper = Verdadero;
Si ConvertirANumero(quantityServices) >= 1 | ConvertirANumero(quantityServices) <= 6 Entonces
time = serviceTime[ConvertirANumero(option)];
name = serviceNames[ConvertirANumero(option)];
SiNo
Escribir "*** OPCION NO VALIDA ***";
i = i - 1;
helper = Falso;
FinSi
Si i == ConvertirANumero(quantityServices) Entonces
allDataIsOk = Verdadero;
SiNo
name = Concatenar(name, " y ");
FinSi
Si helper = Verdadero Entonces
concat = Concatenar(concat, name);
timeTotal = timeTotal + time;
FinSi
FinPara
FinSi
FinMientras
Escribir "-------------------------";
Escribir " SERVICIO AUTOMOTRIZ";
Escribir "-------------------------";
Escribir "Ciente : ", customer;
Escribir "Servicios: ", concat;
Escribir "Tiempo de espera: ", timeTotal;
Escribir "Estado: ", "TRABAJANDO";
Esperar timeTotal * 1000 Milisegundos;
Limpiar Pantalla;
Escribir "-------------------------";
Escribir " SERVICIO AUTOMOTRIZ";
Escribir "-------------------------";
Escribir "Ciente: ", customer;
Escribir "Servicios ", concat;
Escribir "Tiempo de espera: ", timeTotal;
Escribir "Estado: ", "ENTREGADO";
FinAlgoritmo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment