Last active
April 1, 2016 17:57
-
-
Save delatorremario/d26a4e5fe05936d7ff0b to your computer and use it in GitHub Desktop.
Dentalink Modelo de Datos
This file contains hidden or 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
namespace dentalink | |
{ | |
public class Persona | |
{ | |
private string _nombre; | |
public Persona() | |
{ | |
_nombre= "sin asignar"; | |
} | |
public Persona(string nombre) | |
{ | |
_nombre = nombre; | |
} | |
public string getNombre() | |
{ | |
return _nombre; | |
} | |
public void setNombre(string nombre) | |
{ | |
_nombre = nombre; | |
} | |
} | |
public class Alumno : Persona | |
{ | |
} | |
public class Profesor : Persona | |
{ | |
} | |
public class Curso | |
{ | |
private string nombre_curso; | |
private List<Alumno> alumnos; | |
private Profesor profesor; | |
private List<Prueba> pruebas; | |
private List<Nota> notas; | |
public Curso() | |
{ | |
nombre_curso = "sin asignar"; | |
} | |
public Curso(string nombre) | |
{ | |
nombre_curso = nombre; | |
} | |
public string getNombreCurso() | |
{ | |
return nombre_curso; | |
} | |
public void setNombreCurso(string nombre) | |
{ | |
nombre_curso = nombre; | |
} | |
public List<Alumno> getAlumnos(){ | |
return alumnos; | |
} | |
public void inscribirAlumno(Alumno alumno){ | |
alumnos.Add(alumno); | |
} | |
public void asignarProfesor(Profesor profesor) | |
{ | |
this.profesor = profesor; | |
} | |
public Profesor getProfesor() | |
{ | |
return profesor; | |
} | |
public void agregarNota(Prueba prueba,Alumno alumno, decimal nota){ | |
this.notas.Add(new Nota(prueba,alumno,nota)); | |
} | |
public decimal promedioNotas(Alumno _alumno) | |
{ | |
return notas.Where(p => (p.getAlumno().getNombre() == _alumno.getNombre())).ToList().Average(n=>n.getNota()); | |
} | |
} | |
public class Prueba | |
{ | |
private string _nombre_prueba; | |
public Prueba() | |
{ | |
_nombre_prueba = "sin asignar"; | |
} | |
public Prueba(string nombre) | |
{ | |
_nombre_prueba = nombre; | |
} | |
public string getNombrePrueba() | |
{ | |
return _nombre_prueba; | |
} | |
public void setNombrePrueba(string nombre) | |
{ | |
_nombre_prueba = nombre; | |
} | |
} | |
public class Nota | |
{ | |
private Prueba prueba; | |
private Alumno alumno; | |
private decimal nota; | |
public Nota(Prueba prueba, Alumno alumno, decimal nota) | |
{ | |
this.prueba = prueba; | |
this.alumno = alumno; | |
this.nota = nota; | |
} | |
public Alumno getAlumno() | |
{ | |
return alumno; | |
} | |
public Prueba getPrueba() | |
{ | |
return prueba; | |
} | |
public decimal getNota() | |
{ | |
return nota; | |
} | |
} | |
} |
This file contains hidden or 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
namespace mazo_cartas | |
{ | |
public class Mazo | |
{ | |
public List<Carta> cartas; | |
public void mezclar() | |
{ | |
var rnd = new Random(); | |
cartas.OrderBy(x => rnd.Next()).ToList(); | |
} | |
public void repartir(int cartasxjugador,ref List<Jugador> jugadores) | |
{ | |
int nrojugador = 1; | |
foreach (Carta carta in cartas) | |
{ | |
jugadores[nrojugador].cartas.Add(carta); | |
nrojugador++; | |
if (nrojugador == jugadores.Count) | |
{ | |
if (jugadores[nrojugador].cartas.Count == cartasxjugador) break; | |
nrojugador = 1; | |
} | |
} | |
} | |
} | |
public class Carta | |
{ | |
public string nombre; | |
public string color; | |
public int valor; | |
} | |
public class Jugador | |
{ | |
public string nombre; | |
public List<Carta> cartas; | |
} | |
} |
This file contains hidden or 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
SELECT NOMBRE_ALUMNO FROM CURSO_ALUMNO WHERE NOMBRE_CURSO = 'programacion' | |
SELECT AVG(NOTA) AS PROMEDIO FROM CURSO_PRUEBA_ALUMNO WHERE NOMBRE_ALUMNO='mialumno' AND NOMBRE_CURSO='micurso' | |
SELECT NOMBRE_ALUMNO, NOMBRE_CURSO, AVG(NOTA) AS PROMEDIO FROM CURSO_PRUEBA_ALUMNO GROUP BY NOMBRE_ALUMNO, NOMBRE_CURSO | |
--suponiendo que el promedio rojo es menor o igual a 4 em una scala 1 a 10 | |
;with alumnos_rojo (nombre) as | |
(SELECT NOMBRE_ALUMNO | |
FROM CURSO_PRUEBA_ALUMNO | |
GROUP BY NOMBRE_ALUMNO, NOMBRE_CURSO | |
HAVING (AVG(NOTA) <= 4) ) | |
SELECT count(1) as TOTAL_ALUMNOS_VARIOS_ROJOS | |
from (SELECT * FROM alumnos_rojo ar GROUP BY ar.nombre HAVING COUNT(1)>1) AS T |
This file contains hidden or 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
SELECT c1.Nombre, c2.Nombre FROM PLAYERS c1, PLAYERS c2 WHERE c1.Ranking > c2.Ranking | |
a) 400 | |
b) 190 | |
c) 20 | |
d) imposible saberlo | |
RESPUESTA: B | |
tiene 190 tuplas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment