Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import javax.swing.*;
- import java.util.*;
- public class Principal_Escola {
- /**
- * 4) Construa uma classe chamada PRINCIPAL, onde estará o método maim para
- * ser executado. Dentro do método MAIM faca: a. Crie os objetos de
- * 5(quatro) ALUNOS e 3 (dois) PROFESSOR; b. Insira valores em todos os
- * atributos dos objetos acima; c. Construa um Array chamado ARQUIVO_A para
- * armazenar os objetos de ALUNOS e outro Array chamado ARQUIVO_P para
- * armazenar os objetos de PROFESSORES. d. Mostre, a parti dos arrays
- * criados, todos os nomes e matriculas dos alunos e todos os nomes e
- * disciplina dos professores cadastrados.
- */
- public static void main(String[] args) {
- Scanner input = new Scanner( System.in);
- String nome;
- String telefone;
- String sala ;
- String cPF ;
- String data_nascimento ;
- int matricula;
- //Instancias de Alunos
- Aluno aluno01 = new Aluno(nome, telefone, sala, matricula, cPF, data_nascimento);
- Aluno aluno02 = new Aluno(nome, telefone, sala, matricula, cPF, data_nascimento);
- Aluno aluno03 = new Aluno(nome, telefone, sala, matricula, cPF, data_nascimento);
- Aluno aluno04 = new Aluno(nome, telefone, sala, matricula, cPF, data_nascimento);
- Aluno aluno05 = new Aluno(nome, telefone, sala, matricula, cPF, data_nascimento);
- System.out.println ("Quantos Cadastros será feito ?");
- int ler;
- ler = input.nextInt();
- Aluno [] ARQUIVO_X = new Aluno [ler];
- for (int x =0; x <= ARQUIVO_X.length; x++){
- ARQUIVO_X[x] = new Aluno01 (nome, telefone, sala, matricula, cPF, data_nascimento);
- ARQUIVO_X[x] = new Aluno02 (nome, telefone, sala, matricula, cPF, data_nascimento);
- ARQUIVO_X[x] = new Aluno03 (nome, telefone, sala, matricula, cPF, data_nascimento);
- ARQUIVO_X[x] = new Aluno04 (nome, telefone, sala, matricula, cPF, data_nascimento);
- ARQUIVO_X[x] = new Aluno05 (nome, telefone, sala, matricula, cPF, data_nascimento);
- System.out.println ("Nome do Aluno");
- nome = input.next();
- System.out.println ("Telefone");
- telefone = input.next();
- System.out.println ("Sala");
- sala = input.next();
- }
- }//Class Main
- }//Class Principal_Escola
Advertisement
Add Comment
Please, Sign In to add comment