-
-
Save uncoded-ro/b83c482da292ad83c3d69352c439e0f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ro.virtualcampus.app; | |
import ro.virtualcampus.unit.Facultate; | |
import ro.virtualcampus.eval.IPoateEvalua; | |
import ro.virtualcampus.eval.IPoateFiEvaluat; | |
import ro.virtualcampus.person.Persoana; | |
import ro.virtualcampus.person.Student; | |
public class Evaluari { | |
public static void main(String[] args) { | |
Facultate etti = new Facultate("ETTI", "Vasile Parvan nr. 2"); | |
Student studenti[] = new Student[2]; | |
studenti[0] = new Student("Dorina Goia", 23, etti, 2); | |
studenti[1] = new Student("Irina Popescu", 24, etti, 3); | |
for(Student student: studenti) | |
student.esteEvaluat(); | |
IPoateFiEvaluat evaluati[] = new IPoateFiEvaluat[3]; | |
evaluati[0] = studenti[0]; | |
evaluati[1] = studenti[1]; | |
evaluati[2] = new Persoana("Virgil Ionescu", 34); | |
for(IPoateFiEvaluat evaluat: evaluati) | |
evaluat.esteEvaluat(); | |
System.out.println((evaluati[1] instanceof IPoateEvalua)? | |
String.format("%s poate evalua.", ((Student) evaluati[1]).getNume()): | |
String.format("%s nu poate evalua.", ((Student) evaluati[1]).getNume())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment