part 2 hw week 2.txt - public partial class Form1 Form cfw public Form1 cfw InitializeComponent private void button1_Click(object sender EventArgs e cfw

part 2 hw week 2.txt - public partial class Form1 Form cfw...

This preview shows page 1 - 2 out of 2 pages.

public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int intDrawersPerDesk = 0; int intAllDesks = 0; //1. checking if textBox of wood type is empty: string strWoodType = textBoxWoodType.Text; if (strWoodType != String.Empty) { //2. checking if its a number for number of desks if (int.TryParse(textBoxDrawsPerDesk.Text.Trim(), out intDrawersPerDesk)) { //3. checking if its a number for number of drawers if (int.TryParse(textBoxAllDesks.Text.Trim(), out intAllDesks)) { //4. calculations, and checking of any of the numbers are zero int intAllDrawers = NumberOfDrawers(intDrawersPerDesk, intAllDesks); if (intAllDrawers > 0) { //5. checking exact wood type string strShortWoodType = WoodType(strWoodType); if (strShortWoodType != "error") { float fTotal = CalculateTotalCost(strWoodType, intAllDrawers); MessageBox.Show("The total code is " + fTotal + "."); } else MessageBox.Show("Please enter the correct wood
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • Fall '16
  • Dr. Udoh

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture