Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class vetor {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- String[] nome = new String[2];
- double[] nota1 = new double[2];
- double[] nota2 = new double[2];
- int[] matricula = new int[2];
- int i, j;
- int[] check = new int[2];
- double media;
- Scanner ler = new Scanner(System.in);
- for (i = 0; i < 2; i++) {
- System.out.println("Digite seu nome : ");
- nome[i] = ler.next();
- System.out.println("Digite sua matricula para cadastrar : ");
- matricula[i] = ler.nextInt();
- System.out.println("Digite a primeira nota : ");
- nota1[i] = ler.nextDouble();
- System.out.println("Digite a segunda nota : ");
- nota2[i] = ler.nextDouble();
- }
- for (i = 0; i < 2; i++) {
- System.out.println("Tirar a media(Digite sua matricula) : ");
- check[i] = ler.nextInt();
- if (check[i] == matricula[i]) {
- media = (nota1[i] + nota2[i]) / 2;
- System.out.println(nome[i] + ", sua média : " + media);
- } else {
- System.out.println("MATRICULA NÃO EXISTE ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement