my code is not working, can you tell me how to correct it please. 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 Final { public partial class Form1 : Form { static int count1 = 0, count2 = 0, count3 = 0, car1Sale = 0, car2Sale = 0, car3Sale = 0; public Form1() { InitializeComponent(); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { chkPanel1(); textBox4.Text = Convert.ToString(count1 + count2 + count3); saleCalulate(); } private void checkBox14_CheckedChanged(object sender, EventArgs e) { chkPanel2(); textBox4.Text = Convert.ToString(count1 + count2 + count3); saleCalulate(); } private void button2_Click(object sender, EventArgs e) { foreach (Control cBox in this.panel1.Controls) { if (cBox is CheckBox) { ((CheckBox)cBox).Checked = false; } } foreach (Control cBox in this.panel2.Controls) { if (cBox is CheckBox) { ((CheckBox)cBox).Checked = false; } } foreach (Control cBox in this.panel3.Controls) { if (cBox is CheckBox) { ((CheckBox)cBox).Checked = false; } } clearAvailable(); } private void chkPanel1() { clearAvailable(); count1 = 0; foreach (Control c in this.panel1.Controls) { if (c is CheckBox) { if (((CheckBox)c).Checked) { count1++; textBox1.Text = count1.ToString(); } } } } private void clearAvailable() { textBox10.Text = ""; textBox11.Text = ""; textBox12.Text = ""; textBox9.Text = ""; } private void chkPanel2() { clearAvailable(); count2 = 0; foreach (Control c in this.panel2.Controls) { if (c is CheckBox) { if (((CheckBox)c).Checked) { count2++; textBox2.Text = count2.ToString(); } } } } private void chkPanel3() { clearAvailable(); count3 = 0; foreach (Control c in this.panel3.Controls) { if (c is CheckBox) { if (((CheckBox)c).Checked) { count3++; textBox3.Text = count3.ToString(); } } } } private void Form1_Load(object sender, EventArgs e) { chkPanel1(); chkPanel2(); chkPanel3(); textBox4.Text = Convert.ToString(count1 + count2 + count3); saleCalulate(); } private void saleCalulate() { car1Sale = count1 * 300; car2Sale = count2 * 200; car3Sale = count3 * 100; textBox5.Text = "$" + car1Sale; textBox6.Text = "$" + car2Sale; textBox7.Text = "$" + car3Sale; textBox8.Text = "$" + Convert.ToString(car1Sale + car2Sale + car3Sale); } private void checkBox40_CheckedChanged(object sender, EventArgs e) { chkPanel3(); textBox4.Text = Convert.ToString(count1 + count2 + count3); saleCalulate(); } private void button1_Click(object sender, EventArgs e) { textBox9.Text = Convert.ToString(50 - (count1 + count2 + count3)); textBox10.Text = (10 - count1).ToString(); textBox11.Text = (20 - count2).ToString(); textBox12.Text = (20 - count3).ToString(); } } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

my code is not working, can you tell me how to correct it please.

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 Final
{
public partial class Form1 : Form
{

static int count1 = 0, count2 = 0, count3 = 0, car1Sale = 0, car2Sale = 0, car3Sale = 0;
public Form1()
{
InitializeComponent();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
chkPanel1();
textBox4.Text = Convert.ToString(count1 + count2 + count3);
saleCalulate();

}
private void checkBox14_CheckedChanged(object sender, EventArgs e)
{
chkPanel2();
textBox4.Text = Convert.ToString(count1 + count2 + count3);
saleCalulate();
}
private void button2_Click(object sender, EventArgs e)
{
foreach (Control cBox in this.panel1.Controls)
{
if (cBox is CheckBox)
{
((CheckBox)cBox).Checked = false;
}
}
foreach (Control cBox in this.panel2.Controls)
{
if (cBox is CheckBox)
{
((CheckBox)cBox).Checked = false;
}
}
foreach (Control cBox in this.panel3.Controls)
{
if (cBox is CheckBox)
{
((CheckBox)cBox).Checked = false;
}
}
clearAvailable();
}
private void chkPanel1()
{
clearAvailable();
count1 = 0;
foreach (Control c in this.panel1.Controls)
{
if (c is CheckBox)
{
if (((CheckBox)c).Checked)
{
count1++;
textBox1.Text = count1.ToString();
}
}
}
}
private void clearAvailable()
{
textBox10.Text = "";
textBox11.Text = "";
textBox12.Text = "";
textBox9.Text = "";
}
private void chkPanel2()
{
clearAvailable();
count2 = 0;
foreach (Control c in this.panel2.Controls)
{
if (c is CheckBox)
{
if (((CheckBox)c).Checked)
{
count2++;
textBox2.Text = count2.ToString();
}
}
}
}
private void chkPanel3()
{
clearAvailable();
count3 = 0;
foreach (Control c in this.panel3.Controls)
{
if (c is CheckBox)
{
if (((CheckBox)c).Checked)
{
count3++;
textBox3.Text = count3.ToString();
}
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
chkPanel1();
chkPanel2();
chkPanel3();
textBox4.Text = Convert.ToString(count1 + count2 + count3);
saleCalulate();
}

private void saleCalulate()
{
car1Sale = count1 * 300;
car2Sale = count2 * 200;
car3Sale = count3 * 100;
textBox5.Text = "$" + car1Sale;
textBox6.Text = "$" + car2Sale;
textBox7.Text = "$" + car3Sale;
textBox8.Text = "$" + Convert.ToString(car1Sale + car2Sale + car3Sale);
}
private void checkBox40_CheckedChanged(object sender, EventArgs e)
{
chkPanel3();
textBox4.Text = Convert.ToString(count1 + count2 + count3);
saleCalulate();
}
private void button1_Click(object sender, EventArgs e)
{
textBox9.Text = Convert.ToString(50 - (count1 + count2 + count3));
textBox10.Text = (10 - count1).ToString();
textBox11.Text = (20 - count2).ToString();
textBox12.Text = (20 - count3).ToString();
}
}
}

o! Form1
CAR #1
groupBox2
CAR #3
A
B
Purchase infomation
1
SEATS TO PURCHASE
CAR #1:
CAR #2:
4
CAR #3:
Total seats to purchase: o
CAR #2
SE
PRICE
groupBox3
CAR #1 A D
$300
SEAT SALES:
CAR #1:
CAR #2
$200
2
CAR #2:
CAR #3 A В СD $100
CAR #3:
Total Sales:
5
Purchase
Clear
Seat infomation:
SEATS AVAILABLE/TOTAL:
TOTAL SEATS:
/50
CAR #1:
/10
CAR #2:
/20
CAR #3:
/20
3.
LO
Transcribed Image Text:o! Form1 CAR #1 groupBox2 CAR #3 A B Purchase infomation 1 SEATS TO PURCHASE CAR #1: CAR #2: 4 CAR #3: Total seats to purchase: o CAR #2 SE PRICE groupBox3 CAR #1 A D $300 SEAT SALES: CAR #1: CAR #2 $200 2 CAR #2: CAR #3 A В СD $100 CAR #3: Total Sales: 5 Purchase Clear Seat infomation: SEATS AVAILABLE/TOTAL: TOTAL SEATS: /50 CAR #1: /10 CAR #2: /20 CAR #3: /20 3. LO
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Design of User Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education