Lab 4 C# assignment

1 answer below »
Lab 4 C# assignment
Answered Same DaySep 23, 2021

Answer To: Lab 4 C# assignment

David answered on Sep 29 2021
145 Votes
45006/Lab4/.vs/Lab4/v14/.suo
45006/Lab4/Lab4/bin/Debug/Lab4.exe
45006/Lab4/Lab4/bin/Debug/Lab4.pdb
45006/Lab4/Lab4/bin/Debug/Lab4.vshost.exe
45006/Lab4/Lab4/frmCheckAdmission.cs
using System;
using System.Windows.Forms;
namespace Lab4
{
public partial class FrmCheckAddmission : Form
{
#region Private variables
/// The total no application accepted
private int _totalNoApplicationAccepted = 0;
/// The total no application rejected
private int _totalNoApplicationRejected = 0;
#endregion
#region Initialize Form
/// Initializes a new instance of the class.
public FrmCheckAddmission(
)
{
InitializeComponent();
}
#endregion
/// Displays the running total.
private void DisplayRunningTotal()
{
lblTotalAccepted.Text = $"Total Accepted: {_totalNoApplicationAccepted}";
lblTotalRejected.Text = $"Total Rejected: {_totalNoApplicationRejected}";
}
/// Handles the Click event of the btnCheck control.
/// The source of the event.
/// The instance containing the event data.
private void btnCheck_Click(object sender, EventArgs e)
{
float highSchoolGrade = 0; //Variable to store value of High School Grade
int admissionTestScore = 0; //Variable to store value of Admission Test Score
//Check whether High School Grade is valid
if (!string.IsNullOrWhiteSpace(txtHighSchoolGrade.Text))
{
bool isValidValue = float.TryParse(txtHighSchoolGrade.Text, out highSchoolGrade);
if (!isValidValue || (highSchoolGrade < 0 || highSchoolGrade > 4))
{
MessageBox.Show("Please Enter Valid High School Grade between 0.0 to 4.0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtHighSchoolGrade.Focus();
return;
}
}
else
{
MessageBox.Show("Please Enter High School Grade", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtHighSchoolGrade.Focus();
return;
}
//Check whether Admission Test Score is valid
if (!string.IsNullOrWhiteSpace(txtTestScore.Text))
{
bool isValidValue = int.TryParse(txtTestScore.Text, out admissionTestScore);
if (!isValidValue || (admissionTestScore < 0 || admissionTestScore > 100))
{
MessageBox.Show("Please Enter Valid Admission Test Score between 0 to 100", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtTestScore.Focus();
return;
}
}
else
{
MessageBox.Show("Please Enter Admission Test Score", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtTestScore.Focus();
return;
}
//
if ((highSchoolGrade >= 3 && admissionTestScore >= 60) || (highSchoolGrade <= 3 && admissionTestScore >= 80))
{
MessageBox.Show("Accepted", "Accepted", MessageBoxButtons.OK, MessageBoxIcon.None);
_totalNoApplicationAccepted += 1;
}
else
{
MessageBox.Show("Rejected", "Rejected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
_totalNoApplicationRejected += 1;
}
DisplayRunningTotal();
}
/// Handles the Load event of the frmCheckAddmission control.
/// The source of the event.
/// The instance containing the event data.
private void frmCheckAddmission_Load(object sender, EventArgs e)
{
DisplayRunningTotal();
}
}
}
45006/Lab4/Lab4/frmCheckAdmission.Designer.cs
namespace Lab4
{
partial class FrmCheckAddmission
{
///
/// Required designer variable.
///

private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///

/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.lblWelcome = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.btnCheck = new System.Windows.Forms.Button();
this.lblTestScore = new System.Windows.Forms.Label();
this.txtTestScore = new System.Windows.Forms.TextBox();
this.txtHighSchoolGrade = new System.Windows.Forms.TextBox();
this.lblHighSchoolGrade = new System.Windows.Forms.Label();
this.lblTotalAccepted = new System.Windows.Forms.Label();
this.lblTotalRejected = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// lblWelcome
//
this.lblWelcome.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.lblWelcome.AutoSize = true;
this.lblWelcome.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblWelcome.Location = new System.Drawing.Point(226, 27);
this.lblWelcome.Name = "lblWelcome";
this.lblWelcome.Size = new System.Drawing.Size(452, 18);
this.lblWelcome.TabIndex = 0;
this.lblWelcome.Text = "Welcome to University Admission Decision Making System";
//
// panel1
//
this.panel1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.panel1.Controls.Add(this.btnCheck);
this.panel1.Controls.Add(this.lblTestScore);
this.panel1.Controls.Add(this.txtTestScore);
this.panel1.Controls.Add(this.txtHighSchoolGrade);
this.panel1.Controls.Add(this.lblHighSchoolGrade);
this.panel1.Location = new System.Drawing.Point(12, 146);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(857, 381);
this.panel1.TabIndex = 1;
//
// btnCheck
//
this.btnCheck.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnCheck.Location = new System.Drawing.Point(259, 115);
this.btnCheck.Name = "btnCheck";
this.btnCheck.Size =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here