Advertisement
Todorov99

Untitled

Oct 14th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. package Persno;
  2.  
  3. import java.util.ArrayList;
  4.  
  5.  
  6. public class TestPerson {
  7.    
  8.     public static void nameOfEverything(Student[] arr1, Teacher[] arr2, Course[] arr) {
  9.        
  10.         for(int i = 0; i < arr.length; i++) {
  11.             if(arr[i].getNumber() == 4) {
  12.                 System.out.println("" + arr1[i] + arr2[i] + arr[i]);
  13.             }
  14.        
  15.         }
  16.     }
  17.     public static void main(String[] args) {
  18.        
  19.        
  20.     Course[] school = new Course[3];
  21.     Teacher[] teach = new Teacher[3];
  22.     Student[] buddy = new Student[3];
  23.    
  24.    
  25.     Course student1 = new Course("Mat", 5);
  26.     Course student2 = new Course("Bel", 4);
  27.     Course student3 = new Course("Geografiq", 7);
  28.    
  29.     school[0] = student1;
  30.     school[1] = student2;
  31.     school[2] = student3;
  32.    
  33.    
  34.     Teacher teach1 = new Teacher("Georgi", "99856", school);
  35.     Teacher teach2 = new Teacher("Ivan", "99856", school);
  36.     Teacher teach3 = new Teacher("Petkan", "99856", school);
  37.    
  38.     teach[0] = teach1;
  39.     teach[1] = teach2;
  40.     teach[2] = teach3;
  41.    
  42.     Student budy1 = new Student("Petar Petrov", "854786", "56485200");
  43.     Student budy2 = new Student("Georgi Dragiv", "854786", "56485200");
  44.     Student budy3 = new Student("Petkan Petkanov", "854786", "56485200");
  45.    
  46.    
  47.     buddy[0] = budy1;
  48.     buddy[1] = budy2;
  49.     buddy[2] = budy3;
  50.    
  51.     for(int i = 0; i < school.length; i++) {
  52.        
  53.         System.out.println("" + buddy[i] + teach[i] + school[i]);
  54.     }
  55.    
  56.     System.out.println("");
  57.    
  58.     nameOfEverything(buddy, teach, school);
  59.    
  60.    
  61.  
  62.  }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement