Guest User

Codigo Java

a guest
Nov 16th, 2012
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.20 KB | None | 0 0
  1. import java.util.Scanner;
  2. import javax.swing.*;
  3. import java.util.*;
  4. public class Principal_Escola {
  5.    
  6.  
  7.     /**
  8.      * 4) Construa uma classe chamada PRINCIPAL, onde estará o método maim para
  9.      * ser executado. Dentro do método MAIM faca: a. Crie os objetos de
  10.      * 5(quatro) ALUNOS e 3 (dois) PROFESSOR; b. Insira valores em todos os
  11.      * atributos dos objetos acima; c. Construa um Array chamado ARQUIVO_A para
  12.      * armazenar os objetos de ALUNOS e outro Array chamado ARQUIVO_P para
  13.      * armazenar os objetos de PROFESSORES. d. Mostre, a parti dos arrays
  14.      * criados, todos os nomes e matriculas dos alunos e todos os nomes e
  15.      * disciplina dos professores cadastrados.
  16.      */
  17.     public static void main(String[] args) {
  18.         Scanner input = new Scanner( System.in);
  19.        
  20.         String nome;
  21.         String telefone;
  22.         String sala ;
  23.         String cPF ;
  24.         String data_nascimento ;
  25.         int matricula;
  26.        
  27.         //Instancias de Alunos     
  28.         Aluno aluno01 = new Aluno(nome, telefone, sala, matricula, cPF, data_nascimento);
  29.         Aluno aluno02 = new Aluno(nome, telefone, sala, matricula, cPF, data_nascimento);
  30.         Aluno aluno03 = new Aluno(nome, telefone, sala, matricula, cPF, data_nascimento);
  31.         Aluno aluno04 = new Aluno(nome, telefone, sala, matricula, cPF, data_nascimento);
  32.         Aluno aluno05 = new Aluno(nome, telefone, sala, matricula, cPF, data_nascimento);
  33.        
  34.         System.out.println ("Quantos Cadastros será feito ?");
  35.         int ler;
  36.         ler = input.nextInt();
  37.         Aluno [] ARQUIVO_X = new Aluno [ler];
  38.    
  39.         for (int x =0; x <= ARQUIVO_X.length; x++){
  40.         ARQUIVO_X[x] = new Aluno01 (nome, telefone, sala, matricula, cPF,           data_nascimento);
  41.         ARQUIVO_X[x] = new Aluno02 (nome, telefone, sala, matricula, cPF, data_nascimento);
  42.         ARQUIVO_X[x] = new Aluno03 (nome, telefone, sala, matricula, cPF, data_nascimento);
  43.         ARQUIVO_X[x] = new Aluno04 (nome, telefone, sala, matricula, cPF, data_nascimento);
  44.         ARQUIVO_X[x] = new Aluno05 (nome, telefone, sala, matricula, cPF, data_nascimento);
  45.        
  46.         System.out.println ("Nome do Aluno");
  47.         nome = input.next();
  48.         System.out.println ("Telefone");
  49.         telefone = input.next();
  50.         System.out.println ("Sala");
  51.         sala = input.next();
  52.            
  53.            
  54.         }
  55.    
  56.    
  57.    
  58.    
  59.  
  60.    
  61.    
  62.    
  63.     }//Class Main
  64.  
  65. }//Class Principal_Escola
Advertisement
Add Comment
Please, Sign In to add comment