fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. //import java.util.*;
  4. //import java.lang.*;
  5. //import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Exe4main
  9. {
  10. public static void main (String[] args) // throws java.lang.Exception
  11. {
  12. double mediavar;
  13.  
  14. Media.mediat( Media.notasAlunos );
  15. System.out.println( Media.getMediatotal() );
  16. }
  17. }
  18.  
  19. class Media {
  20.  
  21. private static double mediatotal;
  22. public static double[] notasAlunos = {10, 5, 7, 8, 6, 8, 10, 9, 7, 6, 7, 6, 8, 4, 6};
  23.  
  24. public static double getMediatotal() {
  25. return mediatotal;
  26. }
  27. public static void setMediatotal(double mediatotal) {
  28. Media.mediatotal = mediatotal;
  29. }
  30.  
  31. public static double mediat(double notasAlunos[]) {
  32.  
  33. double soma = 0;
  34. for (int i = 0; i < 15; i++) {
  35. soma = (soma + notasAlunos[i]) / 15;
  36. mediatotal = soma;
  37. }
  38. return soma;
  39. }
  40. }
  41.  
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
0.42027645627841326