Ex1+T2+Question+4

==**The next task is to do a convertor. This is a program that will enable students to convert from any Standard Value to a Metric Value and vice versa. You are only required to program inside each button. Here are some important points:**== · The convertor should allow students to convert both ways from: o Fahrenheit to Celsius (button1). o Centimeter to Feet (button2). o Centimeter to inches (button3). o From Pounds to Kilograms (button4). · The user will write the number to be converted into TextBox1. · You should tackle down any problem that the program may face because of misuse. · The only thing that shouldn’t be tackled down is if the user enters text data instead of a number.

-button 1

decimal a;

a = Int32 .Parse(textBox1.Text); label1.Text = "" +((a - 32) * 5 / 9);

if (textBox1.TextLength > 0){ a = Int32  .Parse(textBox1.Text); textBox1.Text = ""  ; } else{

MessageBox .Show(  "You have to write a number smartypants "  ); }

Button 2 a = Int32  .Parse(textBox1.Text); label1.Text = "" + (a / 30.48);

if (textBox1.TextLength > 0) a = Int32  .Parse(textBox1.Text); textBox1.Text = ""  ; else{ MessageBox .Show(  "You have to write a number smartypants"  ); }

Button 3

a = Int32 .Parse(textBox1.Text);label1.Text = "" + (a / 2.54);

if (textBox1.TextLength > 0) a = Int32  .Parse(textBox1.Text); textBox1.Text = ""  ; else{ MessageBox .Show(  "You have to write a number smartypants"  ); }

Button 4

a = Int32 .Parse(textBox1.Text); label1.Text = "" + (a / 0.45359);

if (textBox1.TextLength > 0) a = Int32  .Parse(textBox1.Text); textBox1.Text = ""  ; else{ MessageBox .Show(  "You have to write a number smartypants "  ); }