0
Well, I know I’m doing it in the least practical way, but I’d like to know how I transfer an instance from one class to another class. I’m creating an algorithm in which I’m going to call a method that’s in class A to take four notes, and they’re all going to be stored inside a vector, but I wanted to call another method right after class B that would divide those four notes, but I don’t even know how to start. follows the code:
MAIN class in which I will call the two methods:
public class Calculadora
{
public static void main(String[] args)
{
CalculadoraExec.metodoNotas();
}
}
Class in which I will use the method to pick up the grades:
static double metodoNotas ()
{
Scanner teclado = new Scanner(System.in);
double[] notas = new double [4];
int c2 = 1;
for (int c=0;c<=notas.length-1; c++)
{
System.out.println("NOTA "+c2);
double n = teclado.nextDouble();
notas[c] = n;
c2++;
}
teclado.close();
System.out.println(Arrays.toString(notas));
return 0;
}
}
Now as I do to pick up the 4 typed notes and play for the Media class?