Mi problema es sobre imprimir el resultado de 3 funciones: El promedio de notas, la nota más alta y la más baja, me sale error, cómo hago para mostrar su resultado en las líneas de impresión?
class Program
{
//CREAR ARREGLO GLOBAL
float[] calificaciones = new float[0];
public void Main(string[] args)
{
//VARIBALES NECESARIAS
int cantidad = 0;
string valor = "";
//SE PIDEN LA CANTIDAD DE ALUMNOS
Console.Write("INGRESE LA CANTIDAD DE ALUMNOS: ");
valor = Console.ReadLine();
cantidad = Convert.ToInt32(valor);
float[] calificaciones = new float[cantidad];
obtenerNotas(cantidad);
obtenerPromedio(cantidad);
notaMinima(cantidad);
notaMaxima(cantidad);
//PONER LOS RESULTADOS
Console.Clear();
Console.WriteLine(); //DONDE SALE EL ERROR
Console.WriteLine(notaMaxima(float)); //DONDE SALE EL ERROR
Console.WriteLine(notaMinima(float)); //DONDE SALE EL ERROR
Console.ReadKey();
}
//CAPTURAR LA INFORMACIÓN DE LAS NOTAS
public void obtenerNotas (int a)
{
int cantidad = a;
for (int n = 0; n < cantidad ; n++)
{
Console.Clear();
Console.Write("INGRESE LA CALIFICACIÓN DEL ALUMNO NÚMERO " + (n+1) + ": ");
string valor = Console.ReadLine();
calificaciones[n] = Convert.ToSingle(valor);
}
}
//ENCONTRAMOS EL PROMEDIO
public float obtenerPromedio(int b)
{
int cantidad = b;
float suma = 0;
for (int n = 0; n < cantidad; n++)
{
suma += calificaciones[n];
}
float promedio = suma / cantidad;
return promedio;
}
//ENCONTRAMOS LA CALIFICACIÓN MÁS BAJA
public float notaMinima (int c)
{
int cantidad = c;
float minima = 0;
for (int n = 0; n < cantidad; n++)
{
if (calificaciones[n] < minima)
minima = calificaciones[n];
}
return minima;
}
//ENCONTRAMOS LA CALIFICACIÓN MÁS ALTA
public float notaMaxima(int d)
{
int cantidad = d;
float maxima = 0;
for (int n = 0; n < cantidad; n++)
{
if (calificaciones[n] > maxima)
maxima = calificaciones[n];
}
return maxima;
}
}
notaMaxima
recibe un entero y le intenta pasar un nombre de variable que forma parte de las palabras reservadas del lenguajefloat
es un tipo de dato. quizá debería pasar un array como parámetro