Advertisement
Ecchijpbp

Programación 4-1

Apr 20th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. int contador;
  16. double acumulador;
  17. int libres, regulares, promocionados;
  18.  
  19. public Form1()
  20. {
  21. InitializeComponent();
  22. contador = 0;
  23. acumulador = 0;
  24. libres = regulares = promocionados = 0;
  25. }
  26.  
  27. private void button1_Click(object sender, EventArgs e)
  28. {
  29. Alumno a;
  30. a = new Alumno();
  31. double p;
  32. a.pLegajo = Convert.ToInt32(txtLegajo.Text);
  33. a.pNombre = txtNombre.Text;
  34. a.pApellido = txtApellido.Text;
  35. a.pDocumento = Convert.ToInt32(txtDocumento.Text);
  36. a.pTipoDocumento = cmbtipoDocumento.SelectedIndex;
  37. if(rbM.Checked)
  38. {
  39. a.pSexo = true;
  40. }
  41. else
  42. {
  43. a.pSexo = false;
  44. }
  45. a.pFechaNacimiento = dtpFecha.Value;
  46. a.pNota1 = Convert.ToDouble(txtNota1.Text);
  47. a.pNota2 = Convert.ToDouble(txtNota2.Text);
  48. a.pNota3 = Convert.ToDouble(txtNota3.Text);
  49. acumulador++;
  50. lblTotalAlumnos.Text = Convert.ToString(acumulador);
  51. p = a.calcularPromedio();
  52. if (p >= 4)
  53. {
  54. if (p >= 8)
  55. {
  56. promocionados++;
  57. lblPromocionado.Text = Convert.ToString(promocionados);
  58. }
  59. else
  60. {
  61. regulares++;
  62. lblAprobados.Text = Convert.ToString(regulares);
  63. }
  64. }
  65. else
  66. {
  67. libres++;
  68. lblLibres.Text = Convert.ToString(libres);
  69. }
  70. lblTotalAlumnos.Text = Convert.ToString(acumulador);
  71. lblPAprobados.Text = Convert.ToString(Math.Round((regulares / acumulador) * 100,2));
  72. lblPLibres.Text = Convert.ToString(Math.Round((libres / acumulador) * 100,2));
  73. lblPromocionados.Text = Convert.ToString(Math.Round((promocionados / acumulador) * 100,2));
  74. lblPorcentajeAprobados.Text = Convert.ToString(Math.Round((promocionados + regulares) / acumulador * 100,2));
  75.  
  76.  
  77.  
  78. }
  79.  
  80. private void Form1_Load(object sender, EventArgs e)
  81. {
  82.  
  83. }
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90. }
  91. }
  92. /////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement