Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- int contador;
- double acumulador;
- int libres, regulares, promocionados;
- public Form1()
- {
- InitializeComponent();
- contador = 0;
- acumulador = 0;
- libres = regulares = promocionados = 0;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Alumno a;
- a = new Alumno();
- double p;
- a.pLegajo = Convert.ToInt32(txtLegajo.Text);
- a.pNombre = txtNombre.Text;
- a.pApellido = txtApellido.Text;
- a.pDocumento = Convert.ToInt32(txtDocumento.Text);
- a.pTipoDocumento = cmbtipoDocumento.SelectedIndex;
- if(rbM.Checked)
- {
- a.pSexo = true;
- }
- else
- {
- a.pSexo = false;
- }
- a.pFechaNacimiento = dtpFecha.Value;
- a.pNota1 = Convert.ToDouble(txtNota1.Text);
- a.pNota2 = Convert.ToDouble(txtNota2.Text);
- a.pNota3 = Convert.ToDouble(txtNota3.Text);
- acumulador++;
- lblTotalAlumnos.Text = Convert.ToString(acumulador);
- p = a.calcularPromedio();
- if (p >= 4)
- {
- if (p >= 8)
- {
- promocionados++;
- lblPromocionado.Text = Convert.ToString(promocionados);
- }
- else
- {
- regulares++;
- lblAprobados.Text = Convert.ToString(regulares);
- }
- }
- else
- {
- libres++;
- lblLibres.Text = Convert.ToString(libres);
- }
- lblTotalAlumnos.Text = Convert.ToString(acumulador);
- lblPAprobados.Text = Convert.ToString(Math.Round((regulares / acumulador) * 100,2));
- lblPLibres.Text = Convert.ToString(Math.Round((libres / acumulador) * 100,2));
- lblPromocionados.Text = Convert.ToString(Math.Round((promocionados / acumulador) * 100,2));
- lblPorcentajeAprobados.Text = Convert.ToString(Math.Round((promocionados + regulares) / acumulador * 100,2));
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- }
- }
- /////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement