Professional Documents
Culture Documents
Nome: Luiz Fernando Pontes Professores: Francisco e Rodolfo
Nome: Luiz Fernando Pontes Professores: Francisco e Rodolfo
Atividade de TPA
Codigos:
/*
* Created by SharpDevelop.
* Usuário: FE
* Data: 03/10/2021
* Hora: 23:14
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace TPA_3Bi
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
float [] Contribuição = new float[10];
int i = 0;
void Button1Click(object sender, EventArgs e)
{
if(i<10)
{
Contribuição[i] = float.Parse(textBox1.Text);
i++;
if(i==10)
{
panel1.Visible = false;
panel2.Visible = true;
}
}
}
void Button2Click(object sender, EventArgs e)
{
for(int i=0; i<10; i++)
{
listBox1.Items.Add (Contribuição[i]);
}
button2.Enabled = false;
button4.Enabled = true;
}
void Button3Click(object sender, EventArgs e)
{
i=0;
for(int a = 0; a<10; a++)
{
Contribuição [a] = 0;
}
textBox1.Text = ("");
listBox1.Items.Clear ();
panel2.Visible = false;
panel1.Visible = true;
listBox1.Visible = true;
button2.Enabled = true;
button3.Enabled = false;
}
void Button4Click(object sender, EventArgs e)
{
float aux = 0;
for(int i=0; i<10;i++)
{
aux += Contribuição [i];
}
listBox1.Visible = false;
label1.Text = ("Total: "+aux);
button3.Enabled = true;
button4.Enabled = false;
}
}
}
Imagens: