Priority Code in C# with Gantt Chart, If Else Method

Only available on StudyMode
  • Topic: PageRank
  • Pages : 33 (4568 words )
  • Download(s) : 506
  • Published : July 16, 2012
Open Document
Text Preview
private void btnCompute_Click(object sender, EventArgs e)
{

if ((txtP1.Text == "") || (txtP2.Text == "") || (txtP3.Text == "") || (txtP4.Text == "") || (txtP5.Text == "") || (txt1.Text == "") || (txt2.Text == "") || (txt3.Text == "") || (txt4.Text == "") || (txt5.Text == "")) {

MessageBox.Show("Please complete the Burst Time/Priority", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); }
else
{
int[] input = new int[5];
int sum;
int P1 = System.Convert.ToInt32(txtP1.Text); int P2 = System.Convert.ToInt32(txtP2.Text); int P3 = System.Convert.ToInt32(txtP3.Text); int P4 = System.Convert.ToInt32(txtP4.Text); int P5 = System.Convert.ToInt32(txtP5.Text);

int Pr1 = System.Convert.ToInt32(txt1.Text); int Pr2 = System.Convert.ToInt32(txt2.Text); int Pr3 = System.Convert.ToInt32(txt3.Text); int Pr4 = System.Convert.ToInt32(txt4.Text); int Pr5 = System.Convert.ToInt32(txt5.Text); {

if ((Pr1 == 1) & (Pr2 == 2) & (Pr3 == 3) & (Pr4 == 4) & (Pr5 == 5)) {
sum = (0 + P1 + P2 + P3 + P4) / 5;
{
txtAve.Text = sum.ToString();
txtWait.Text = ("P1= " + txtP1.Text + ", P2= " + txtP2.Text + ", P3= " + txtP3.Text + ", P4= " + txtP4.Text); }
}
else if ((Pr1 == 1) & (Pr2 == 2) & (Pr3 == 4) & (Pr4 == 3) & (Pr5 == 5)) {
sum = (0 + P1 + P2 + P4 + P3) / 5;
{
txtAve.Text = sum.ToString();
txtWait.Text = ("P1= " + txtP1.Text + ", P2= " + txtP2.Text + ", P4= " + txtP4.Text + ", P3= " + txtP3.Text); }
}
else if ((Pr1 == 1) & (Pr2 == 3) & (Pr3 == 2) & (Pr4 == 4) & (Pr5 == 5)) {
sum = (0 + P1 + P3 + P2 + P4) / 5;
{
txtAve.Text = sum.ToString();
txtWait.Text = ("P1= " + txtP1.Text + ", P3= " + txtP3.Text + ", P2= " + txtP2.Text + ", P4= " + txtP4.Text); }
}
else if ((Pr1 == 1) & (Pr2 == 3) & (Pr3 == 4) & (Pr4 == 2) & (Pr5 == 5)) {
sum = (0 + P1 + P3 + P4 + P2) / 5;
{
txtAve.Text = sum.ToString();
txtWait.Text = ("P1= " + txtP1.Text + ", P3= " + txtP3.Text + ", P4= " + txtP4.Text + ", P2= " + txtP2.Text); }
}
else if ((Pr1 == 1) & (Pr2 == 4) & (Pr3 == 3) & (Pr4 == 2) & (Pr5 == 5)) {
sum = (0 + P1 + P4 + P3 + P2) / 5;
{
txtAve.Text = sum.ToString();
txtWait.Text = ("P1= " + txtP1.Text + ", P4= " + txtP4.Text + ", P3= " + txtP3.Text + ", P2= " + txtP2.Text); }
}
else if ((Pr1 == 1) & (Pr2 == 4) & (Pr3 == 2) & (Pr4 == 3) & (Pr5 == 5)) {
sum = (0 + P1 + P4 + P2 + P3) / 5;
{
txtAve.Text = sum.ToString();
txtWait.Text = ("P1= " + txtP1.Text + ", P4= " + txtP4.Text + ", P2= " + txtP2.Text + ", P3= " + txtP3.Text); }
}
else if ((Pr1 == 1) & (Pr2 == 3) & (Pr3 == 4) & (Pr4 == 5) & (Pr5...
tracking img