Advertisement
Ecchijpbp

Programación 4-2

Apr 20th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace WindowsFormsApplication1
  8. {
  9. class Alumno
  10. {
  11. private int legajo;
  12. private string nombre;
  13. private string apellido;
  14. private int documento;
  15. private int tipodocumento;
  16. private bool sexo;
  17. private DateTime fechanacimiento;
  18. private double nota1;
  19. private double nota2;
  20. private double nota3;
  21. private double promedio;
  22.  
  23. public int pLegajo
  24. { set { legajo = value; } get { return legajo; } }
  25. public string pNombre
  26. { set { nombre = value; } get { return nombre; } }
  27. public string pApellido
  28. { set { apellido = value; } get { return apellido; } }
  29. public int pDocumento
  30. { set { documento = value; } get { return documento; } }
  31. public int pTipoDocumento
  32. { set { tipodocumento = value; } get { return tipodocumento; } }
  33. public bool pSexo
  34. { set { sexo = value; } get { return sexo; } }
  35. public DateTime pFechaNacimiento
  36. { set { fechanacimiento = value; } get { return fechanacimiento; } }
  37. public double pNota1
  38. { set { nota1 = value; } get { return nota1; } }
  39. public double pNota2
  40. { set { nota2 = value; } get { return nota2; } }
  41. public double pNota3
  42. { set { nota3 = value; } get { return nota3; } }
  43.  
  44. public double calcularPromedio()
  45. { return (nota1 + nota2 + nota3) / 3; }
  46.  
  47. public string tostring()
  48. {
  49. if (sexo == true)
  50. return "Masculino";
  51. else
  52. return "Femenino";
  53. }
  54. public string toString()
  55. {
  56. return
  57. "Legajo: " + Convert.ToString(legajo) + "\n" +
  58. "Nombre: " + nombre + "\n" +
  59. "Apellido: " + apellido + "\n" +
  60. "Documento: " + documento + "\n" +
  61. "Tipo Documento: " + Convert.ToString(tipodocumento) + "\n" +
  62. "Sexo: " + Convert.ToString(sexo) + "\n" +
  63. "Fecha Nacimiento: " + Convert.ToString(fechanacimiento) + "\n" +
  64. "Notas: " + nota1 + ";" + nota2 + ";" + nota3 + ".";
  65.  
  66. }
  67. public string toStringCondicion()
  68. {
  69. double c = (calcularPromedio());
  70. if (c >= 4)
  71. return "Aprobado";
  72. else
  73. return "Libre";
  74. }
  75. public string tipoDocToInt()
  76. {
  77. if (tipodocumento == 0)
  78. {
  79. return "DNI";
  80. }
  81. if (tipodocumento == 1)
  82. {
  83. return "Pasaporte";
  84. }
  85. else
  86. {
  87. return "Libreta Civica";
  88. }
  89. }
  90.  
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement