Advertisement
Guest User

Media

a guest
Jun 19th, 2013
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. package nota;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Nota {
  6.  
  7.  
  8.     public static void main(String[] args) {
  9.         int y = 0;
  10.         double acum = 0;
  11.         double media = 0;
  12.         double maiormedia = 0;
  13.         int maiorposicao = 0;
  14.         String[] nomes = new String[3];
  15.         double[][] notas = new double[3][3];
  16.         for (int i = 1; i < nomes.length; i++) {
  17.             System.out.println("Aluno: " + i);
  18.             nomes[i] = (new Scanner(System.in)).nextLine();
  19.             for (int j = 0; j < 3; j++) {
  20.                 System.out.println("Digite sua nota: " + j);
  21.                 notas[i][j] = (new Scanner(System.in)).nextDouble();
  22.                 acum = acum + notas[i][j];
  23.             }
  24.             media = acum / 3;
  25.             if (media > maiormedia) {
  26.                 maiormedia = media;
  27.                 maiorposicao = i;
  28.             }
  29.             System.out.println("A maior média foi" + maiormedia + "do aluno" + nomes[i]);
  30.  
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement