fork download
  1. /* package whatever; // dondef calcular_sueldo(vendedor, prendas_vendidas):
  2.   sueldo_base = 800
  3.   if prendas_vendidas <= 50:
  4.   categoria = 'Baja'
  5.   comision_por_prenda = 2.00
  6.   elif 51 <= prendas_vendidas <= 100:
  7.   categoria = 'Media'
  8.   comision_por_prenda = 3.50
  9.   else:
  10.   categoria = 'Alta'
  11.   comision_por_prenda = 5.00
  12.  
  13.   comision_total = prendas_vendidas * comision_por_prenda
  14.   sueldo_total = sueldo_base + comision_total
  15.   return {
  16.   'Vendedor': vendedor,
  17.   'Prendas Vendidas': prendas_vendidas,
  18.   'Categoría': categoria,
  19.   'Comisión Total': comision_total,
  20.   'Sueldo Total': sueldo_total
  21.   }
  22.  
  23. # Ejemplo de uso
  24. vendedores = [
  25.   {'nombre': 'Juan Pérez', 'ventas': 45},
  26.   {'nombre': 'Ana Gómez', 'ventas': 75},
  27.   {'nombre': 'Luis Martínez', 'ventas': 120}
  28. ]
  29.  
  30. for v in vendedores:
  31.   resultado = calcular_sueldo(v['nombre'], v['ventas'])
  32.   print(f"Vendedor: {resultado['Vendedor']}")
  33.   print(f"Categoría: {resultado['Categoría']}")
  34.   print(f"Comisión Total: ${resultado['Comisión Total']:.2f}")
  35.   print(f"Sueldo Total: ${resultado['Sueldo Total']:.2f}")
  36.   print('-' * 30)
  37. 't place package name! */
  38.  
  39. import java.util.*;
  40. import java.lang.*;
  41. import java.io.*;
  42.  
  43. /* Name of the class has to be "Main" only if the class is public. */
  44. class Ideone
  45. {
  46. public static void main (String[] args) throws java.lang.Exception
  47. {
  48. // your code goes here
  49. }
  50. }
Success #stdin #stdout 0.1s 52624KB
stdin
Standard input is empty
stdout
Standard output is empty