Advertisement
fabi2295

Vetor

May 24th, 2015
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.08 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class vetor {
  4.  
  5.     public static void main(String[] args) {
  6.         // TODO Auto-generated method stub
  7.         String[] nome = new String[2];
  8.         double[] nota1 = new double[2];
  9.         double[] nota2 = new double[2];
  10.         int[] matricula = new int[2];
  11.         int i, j;
  12.         int[] check = new int[2];
  13.         double media;
  14.  
  15.         Scanner ler = new Scanner(System.in);
  16.  
  17.         for (i = 0; i < 2; i++) {
  18.             System.out.println("Digite seu nome : ");
  19.             nome[i] = ler.next();
  20.             System.out.println("Digite sua matricula para cadastrar : ");
  21.             matricula[i] = ler.nextInt();
  22.             System.out.println("Digite a primeira nota : ");
  23.             nota1[i] = ler.nextDouble();
  24.             System.out.println("Digite a segunda nota : ");
  25.             nota2[i] = ler.nextDouble();
  26.         }
  27.  
  28.         for (i = 0; i < 2; i++) {
  29.  
  30.             System.out.println("Tirar a media(Digite sua matricula) : ");
  31.             check[i] = ler.nextInt();
  32.  
  33.             if (check[i] == matricula[i]) {
  34.                 media = (nota1[i] + nota2[i]) / 2;
  35.                 System.out.println(nome[i] + ", sua média : " + media);
  36.             } else {
  37.                 System.out.println("MATRICULA NÃO EXISTE ");
  38.             }
  39.         }
  40.  
  41.     }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement