Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aula10", "Aula10\Aula10.csproj", "{26179F84-83B7-4711-B240-D5BFB9659F15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{26179F84-83B7-4711-B240-D5BFB9659F15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26179F84-83B7-4711-B240-D5BFB9659F15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26179F84-83B7-4711-B240-D5BFB9659F15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26179F84-83B7-4711-B240-D5BFB9659F15}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10.v11.suo
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/App.config
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Aula10.csproj
Debug
AnyCPU
{26179F84-83B7-4711-B240-D5BFB9659F15}
WinExe
Properties
Aula10
Aula10
v4.5
512
AnyCPU
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
AnyCPU
pdbonly
true
bin\Release\
TRACE
prompt
4
Form
Form1.cs
Form1.cs
ResXFileCodeGenerator
Resources.Designer.cs
Designer
True
Resources.resx
SettingsSingleFileGenerator
Settings.Designer.cs
True
Settings.settings
True
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Aula10.v11.suo
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/bin/Debug/Aula10.exe
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/bin/Debug/Aula10.exe.config
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/bin/Debug/Aula10.pdb
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/bin/Debug/Aula10.vshost.exe
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/bin/Debug/Aula10.vshost.exe.config
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/bin/Debug/Aula10.vshost.exe.manifest
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Form1.cs
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 Aula10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Declaração de variáveis
double N1, N2, M;
// Inicio Usuário Bom
try
{
// Entradas
N1 = double.Parse(textBox1.Text);
N2 = double.Parse(textBox2.Text);
// Converte o texto para numero real
if (N1 < 0 || N1 > 10 || N2 < 0 || N2 > 10)
{
// mensagem de erro
MessageBox.Show("Entrada de Notas Inválidas\nDigite as notas novamente!!!", "****** NOTAS INVÁLIDAS ******",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
button2.PerformClick(); // chama button2
}
else
{
M = Math.Sqrt(N1 * N2);
// Processamento - Sqrt extrai raiz quadrada.
M = Math.Round(M, 2);
// Arredonda M para 2 casas decimais.
label4.Text = M.ToString();
// Converte numero real para texto
// verifica se aluno aprovado
if (M >= 5) // se a média é maior ou igual a 5
{
label6.ForeColor = Color.Blue; // escreve em azul
label6.Text = "Aprovado";
}
else // senão
{
label6.ForeColor = Color.Red; // escreve em vermelho
label6.Text = "Reprovado";
}
}
}
// Fim Usuário Bom
// Inicio Usuário Ruim
catch (Exception)
{
MessageBox.Show("Entradas inválidas", "***** ERRO ***** ",
MessageBoxButtons.OK, MessageBoxIcon.Error);
// Mensagem na tela
button2.PerformClick();
// Chamar o botão limpar
}
// Fim Usuário Ruim
}
private void button2_Click(object sender, EventArgs e)
{
// Limpar Entradas
textBox1.Text = "";
textBox2.Text = "";
label4.Text = "";
label6.Text = "";
// Limpar Saidas
textBox1.Focus();
// Volta o cursor para textBox1
}
private void button3_Click(object sender, EventArgs e)
{
// pergunta se deseja mesmo terminar
if (MessageBox.Show("Deseja mesmo terminar", "Finalizando",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1) == DialogResult.Yes)
{
Application.Exit(); // finaliza aplicação
}
}
}
}
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Form1.Designer.cs
namespace Aula10
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// button1
//
this.button1.BackColor = System.Drawing.Color.SkyBlue;
this.button1.Location = new System.Drawing.Point(12, 155);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "&Calcular";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.SkyBlue;
this.button2.Location = new System.Drawing.Point(108, 155);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "&Limpar";
this.button2.UseVisualStyleBackColor = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.BackColor = System.Drawing.Color.SkyBlue;
this.button3.Location = new System.Drawing.Point(204, 155);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 2;
this.button3.Text = "&Sair";
this.button3.UseVisualStyleBackColor = false;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 37);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(42, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Nota 1:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 85);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(42, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Nota 2:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 212);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(45, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Média =";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(105, 212);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(0, 13);
this.label4.TabIndex = 6;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(12, 244);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(58, 13);
this.label5.TabIndex = 7;
this.label5.Text = "Situação =";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(105, 244);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(0, 13);
this.label6.TabIndex = 8;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(108, 34);
this.textBox1.MaxLength = 5;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(75, 20);
this.textBox1.TabIndex = 9;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(108, 82);
this.textBox2.MaxLength = 5;
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(75, 20);
this.textBox2.TabIndex = 10;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Desktop;
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Programa Média do Makoto e Situação";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
}
}
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Form1.resx
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/Aula10.csproj.FileListAbsolute.txt
C:\Users\13099593\Documents\Aula10\Aula10\bin\Debug\Aula10.exe.config
C:\Users\13099593\Documents\Aula10\Aula10\bin\Debug\Aula10.exe
C:\Users\13099593\Documents\Aula10\Aula10\bin\Debug\Aula10.pdb
C:\Users\13099593\Documents\Aula10\Aula10\obj\Debug\Aula10.csprojResolveAssemblyReference.cache
C:\Users\13099593\Documents\Aula10\Aula10\obj\Debug\Aula10.Form1.resources
C:\Users\13099593\Documents\Aula10\Aula10\obj\Debug\Aula10.Properties.Resources.resources
C:\Users\13099593\Documents\Aula10\Aula10\obj\Debug\Aula10.csproj.GenerateResource.Cache
C:\Users\13099593\Documents\Aula10\Aula10\obj\Debug\Aula10.exe
C:\Users\13099593\Documents\Aula10\Aula10\obj\Debug\Aula10.pdb
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Não veio na aula\Média Makoto Situação Final\Aula10\bin\Debug\Aula10.exe.config
E:\Pasta Faculdade\2º Semestre\Informática\Informática
Prof Chacon\Aula10 - Não veio na aula\Média Makoto Situação Final\Aula10\obj\Debug\Aula10.exe
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Não veio na aula\Média Makoto Situação Final\Aula10\obj\Debug\Aula10.pdb
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Não veio na aula\Média Makoto Situação Final\Aula10\bin\Debug\Aula10.exe
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Não veio na aula\Média Makoto Situação Final\Aula10\bin\Debug\Aula10.pdb
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Não veio na aula\Média Makoto Situação Final\Aula10\obj\Debug\Aula10.csprojResolveAssemblyReference.cache
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Não veio na aula\Média Makoto Situação Final\Aula10\obj\Debug\Aula10.Form1.resources
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Não veio na aula\Média Makoto Situação Final\Aula10\obj\Debug\Aula10.Properties.Resources.resources
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Não veio na aula\Média Makoto Situação Final\Aula10\obj\Debug\Aula10.csproj.GenerateResource.Cache
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Condições\Média Makoto Situação Final\Aula10\bin\Debug\Aula10.exe.config
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Condições\Média Makoto Situação Final\Aula10\obj\Debug\Aula10.exe
E:\Pasta Faculdade\2º Semestre\Informática\Informática Prof Chacon\Aula10 - Condições\Média Makoto Situação Final\Aula10\obj\Debug\Aula10.pdb
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/Aula10.csproj.GenerateResource.Cache
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/Aula10.csprojResolveAssemblyReference.cache
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/Aula10.exe
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/Aula10.Form1.resources
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/Aula10.pdb
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/Aula10.Properties.Resources.resources
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/DesignTimeResolveAssemblyReferences.cache
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Aula10
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Properties/AssemblyInfo.cs
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Aula10")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Aula10")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d0edcb27-7f51-487e-bdfb-e3377fa7900a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Properties/Resources.Designer.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18047
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Aula10.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Aula10.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Properties/Resources.resx
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Properties/Settings.Designer.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18047
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Aula10.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
Aula10 - Condicional/M�dia Makoto Situa��o Final/Aula10/Properties/Settings.settings
Aula10 - Condicional/M�dia Makoto Situa��o Final/Projeto.doc
Informática para Engenharia Puc-Campinas
Descrição do Projeto: Média do Makoto e situação final
Desenvolvido por: Igor Felisberto Magalhães
Data: 20/09/2013
Versão: 1.0
Layout do Formulário:
Objeto
Propriedades
Valor
Form1
Text
Programa Média do Makoto e Situação
StartPosition
Centerscreen
BackColor
Desktop
Label1
Text
Nota 1:
Label2
Text
Nota 2:
Label3
Text
Média =
Label4
Text
Label5
Text
Situação =
Label6
Text
TextBox1
MaxLenght
5
TextBox2
MaxLenght
5
Button1
Text
&Calcular
BackColor
SkyBlue
Button2
Text
&Limpar
BackColor
SkyBlue
Button3
Text
&Sair
BackColor
SkyBlue
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 Aula10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Declaração de variáveis
double N1, N2, M;
// Inicio Usuário Bom
try
{
// Entradas
N1 = double.Parse(textBox1.Text);
N2 = double.Parse(textBox2.Text);
// Converte o texto para numero real
if (N1 < 0 || N1 > 10 || N2 < 0 || N2 > 10)
{
// mensagem de erro
MessageBox.Show("Entrada de Notas Inválidas\nDigite as notas novamente!!!", "****** NOTAS INVÁLIDAS ******",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
button2.PerformClick(); // chama button2
}
else
{
M = Math.Sqrt(N1 * N2);
// Processamento - Sqrt extrai raiz quadrada.
M = Math.Round(M, 2);
// Arredonda M para 2 casas decimais.
label4.Text = M.ToString();
// Converte numero real para texto
// verifica se aluno aprovado
if (M >= 5) // se a média é maior ou igual a 5
{
label6.ForeColor = Color.Blue; // escreve em azul
label6.Text = "Aprovado";
}
else // senão
{
label6.ForeColor = Color.Red; // escreve em vermelho
label6.Text = "Reprovado";
}
}
}
// Fim Usuário Bom
// Inicio Usuário Ruim
catch (Exception)
{
MessageBox.Show("Entradas inválidas", "***** ERRO ***** ",
MessageBoxButtons.OK, MessageBoxIcon.Error);
// Mensagem na tela
button2.PerformClick();
// Chamar o botão limpar
}
// Fim Usuário Ruim
}
private void button2_Click(object sender, EventArgs e)
{
// Limpar Entradas
textBox1.Text = "";
textBox2.Text = "";
label4.Text = "";
label6.Text = "";
// Limpar Saidas
textBox1.Focus();
// Volta o cursor para textBox1
}
private void button3_Click(object sender, EventArgs e)
{
// pergunta se deseja mesmo terminar
if (MessageBox.Show("Deseja mesmo terminar", "Finalizando",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1) == DialogResult.Yes)
{
Application.Exit(); // finaliza aplicação
}
}
}
}
�PAGE �
Projeto