ALGORITMO AtencionCafeteria
// 1. Definición de variables
ENTERO cantidadArticulos, i
CADENA nombreArticulo, esClienteRegistrado
REAL precioArticulo, totalPagar, descuento, totalConDescuento
totalPagar = 0.0
// 2. Captura de la cantidad de artículos
ESCRIBIR "Ingrese la cantidad de artículos a pedir:"
LEER cantidadArticulos
// 3. Bucle para procesar cada artículo
PARA i DESDE 1 HASTA cantidadArticulos HACER
ESCRIBIR "Ingrese el nombre del artículo ", i, ":"
LEER nombreArticulo
ESCRIBIR "Ingrese el precio del artículo ", i, ":"
LEER precioArticulo
// Sumamos al total acumulado
totalPagar = totalPagar + precioArticulo
FIN PARA
// 4. Preguntar si el cliente está registrado
ESCRIBIR "¿El cliente está registrado en el sistema? (si/no):"
LEER esClienteRegistrado
// 5. Aplicar la lógica del descuento
SI esClienteRegistrado = "si" ENTONCES
descuento = totalPagar * 0.10
totalConDescuento = totalPagar - descuento
ESCRIBIR "--- RESUMEN DEL PEDIDO ---"
ESCRIBIR "Subtotal: $", totalPagar
ESCRIBIR "Descuento aplicado (10%): -$", descuento
ESCRIBIR "TOTAL A PAGAR: $", totalConDescuento
SINO
ESCRIBIR "--- RESUMEN DEL PEDIDO ---"
ESCRIBIR "TOTAL A PAGAR: $", totalPagar
FIN SI
FIN ALGORITMO