public static void Proxy() { //GeneradorDeDatosAleatorios generador = new GeneradorDeDatosAleatorios(); //IAlumno alumno = new AlumnoProxy(generador.stringAleatorio(8), generador.numeroAleatorio(9999999).getValor()); //Icomparable legajo = new Numero(generador.numeroAleatorio(999).getValor()); //Icomparable promedio = new Numero(generador.numeroAleatorio(10).getValor()); //alumno.setLegajo(legajo); //alumno.setPromedio(promedio); //alumno.SetCalificacion(5); //alumno.respondePreguta(2); //Console.WriteLine(alumno); Teacher teachaer = new Teacher(); Collection students = new ListOfStudent(); Icoleccionable cola = new Cola(); FabricaDeComparables fabrica = new FabricaDeAlumnosProxy(); TP3.llenar(cola, fabrica); Iterador iter = cola.crearIterador(); while (!iter.Fin()) { var alumno = (IAlumno)iter.Actual(); students.addStudent(new AdaptadorEstudiante_Student(alumno)); iter.Siguiente(); } teachaer.setStudents(students); teachaer.teachingAClass(); Console.ReadKey(); }
public static void Adapter() { Teacher teachaer = new Teacher(); Collection students = new ListOfStudent(); Icoleccionable cola = new Cola(); FabricaDeComparables fabrica = new FabricaDeAlumnosConcretos(); TP3.llenar(cola, fabrica); Iterador iter = cola.crearIterador(); while (!iter.Fin()) { var alumno = (Alumno)iter.Actual(); students.addStudent(new AdaptadorEstudiante_Student(alumno)); iter.Siguiente(); } teachaer.setStudents(students); teachaer.teachingAClass(); Console.ReadKey(); }
static void Main(string[] args) { int numberOfStudents = int.Parse(Console.ReadLine()); ListOfStudent studentList = new ListOfStudent(); studentList.AllStudents = new List <Student>(); for (int i = 0; i < numberOfStudents; i++) { string[] data = Console.ReadLine().Split(); Student student = new Student(data[0], data[1], double.Parse(data[2])); studentList.AllStudents.Add(student); } ListOfStudent orderedList = new ListOfStudent(); orderedList.AllStudents = studentList.AllStudents.OrderByDescending(student => student.Grade).ToList(); foreach (Student student in orderedList.AllStudents) { Console.WriteLine($"{student.FirstName} {student.LastName}: {student.Grade:f2}"); } }