checking if its a number for number of drawers if int

Checking if its a number for number of drawers if int

This preview shows page 3 - 4 out of 4 pages.

//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 type (mahogany, oak or pine)." ); MessageBox .Show( "Sum of all drawers is zero. Please higher the number of desk or drawers." ); MessageBox .Show( "Please enter the correct wood type." ); //Calculate the Drawers per desk and all desks return intDrawersPerDesk * intAllDesks; //adding a surcharge for each drawer: fCost = fCost + (intAllDrawers * 30); End: Source Code using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace @as { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click( object sender, EventArgs e) { int intDrawersPerDesk = 0; int intAllDesks = 0; string strWoodType = textBoxWoodType.Text; if (strWoodType != String .Empty) { if ( int .TryParse(textBoxDrawsPerDesk.Text.Trim(), out intDrawersPerDesk)) { if ( int .TryParse(textBoxAllDesks.Text.Trim(), out intAllDesks)) { int intAllDrawers = NumberOfDrawers(intDrawersPerDesk, intAllDesks); if (intAllDrawers > 0) { string
Image of page 3
Image of page 4

You've reached the end of your free preview.

Want to read all 4 pages?

  • Fall '13
  • Davao¬†City, Davao College, wood type, Edward Lance Lorilla, correct wood type

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes