Stadium seating2.docx - using System using System.Collections.Generic using System.ComponentModel using System.Data using System.Drawing using

Stadium seating2.docx - using System using...

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

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace StadiumSeating { public partial class frmStadium : Form { public frmStadium() { InitializeComponent(); } private void btnCalculate_Click(object sender, EventArgs e) { const int CapA = 1000, CapB = 2000, CapC = 3000; decimal priceA = 15, priceB = 12, priceC = 9; int ticketsA, ticketsB, ticketsC, ticketsTotal, totalCap; decimal revA, revB, revC, revTotal; //data entry if (!int.TryParse(txtClassA.Text, out ticketsA)) { MessageBox.Show("Error in number of tickets for A"); return; } if (!int.TryParse(txtClassB.Text, out ticketsB)) { MessageBox.Show("Error in number of tickets for B"); return; } if (!int.TryParse(txtClassC.Text, out ticketsC)) { MessageBox.Show("Error in number of tickets for C"); return; } //range validation if ((ticketsA < 0) || (ticketsA > CapA)) { MessageBox.Show("Number of tickets for A out of range");
Image of page 1
return; } if ((ticketsB < 0) || (ticketsB > CapB)) { MessageBox.Show("Number of tickets for B out of range");
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 4 pages?

  • Spring '17
  • Return statement, Void type, 15M, 1.5m, 9m, 12m

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture