class Ejercicio
def initialize ()
end
def Desarrollo()
suma_e = 0
prom_e = 0
c_m = 0
c_f = 0
puts "ingresar numero de personas:"
STDOUT.flush #el STDOUT nos ayudara a limpiar el valor de una variable
n = gets.chomp
n = n.to_i
x = n-1
a = Array.new
b = Array.new
c = Array.new
for i in 0..x
print "Persona ",i+1,"\n"
print "Nombre: "
a[i] = gets.chomp
a[i] = a[i].to_s.capitalize
printf "\n"
print "Edad: "
b[i] = gets.chomp
b[i] = b[i].to_i
printf "\n"
print "Genero (M/F) : "
c[i] = gets.chomp
c[i] = c[i].to_s.capitalize!
printf "\n"
end
print "-------------------------\n"
puts "LISTA DE PERSONAS:"
printf "\n"
print "Nombre\t\tEdad\tGenero\n"
print "\n"
for i in 0..x
print a[i],"\t", "\t",b[i],"\t",c[i],"\n"
suma_e = suma_e+b[i]
end
for i in 0..x
if (c[i]=="M")
c_m=c_m+1
else
c_f=c_f+1
end
end
print "-------------------------\n"
prom_e = suma_e/n
print "Sumatoria de edades:",suma_e,"\n"
print "Promedio de edades:",prom_e,"\n"
print "Cantidad de hombres:",c_m,"\n"
print "Cantidad de mujeres:",c_f,"\n"
end
end
objeto = Ejercicio.new()
objeto.Desarrollo
gets()