0% found this document useful (0 votes)
2 views

Programming Classes

The document contains four programs that perform various calculations and UI updates. Program 1 calculates the total and average of three numbers, Program 2 computes the cost and tax based on price and quantity, Program 3 calculates salary components and net pay, and Program 4 populates a second combo box based on the selection of the first combo box. Each program updates relevant UI elements with the computed values.

Uploaded by

Abdullahi Idris
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Programming Classes

The document contains four programs that perform various calculations and UI updates. Program 1 calculates the total and average of three numbers, Program 2 computes the cost and tax based on price and quantity, Program 3 calculates salary components and net pay, and Program 4 populates a second combo box based on the selection of the first combo box. Each program updates relevant UI elements with the computed values.

Uploaded by

Abdullahi Idris
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Program 1:

{
int fnum = Convert.ToInt32(txtfnum.Text);
int snum = Convert.ToInt32(txtsnum.Text);
int tnum = Convert.ToInt32(txttnum.Text);
decimal total = fnum + snum + tnum;
label5.Text = total.ToString();
decimal average = total / 3;
label4.Text = average.ToString();

Program 2:
{
int price = Int32.Parse(pricetxt.Text);
decimal quantity = quantitynumeric.Value;
decimal cost = price * quantity;
costtxt.Text = cost.ToString();
decimal tax = price / 100;
taxtxt.Text = tax.ToString();
decimal actualcost = cost + tax ;
actualcosttxt.Text = actualcost.ToString();

Program 3:
{
Decimal salary = Int32.Parse(txtsalary.Text);
Decimal DA = salary / 100 * 30 ;
lblda.Text = DA.ToString();
Decimal HRA = salary / 100 * 12;
lblhra.Text = HRA.ToString();
Decimal PF = salary / 100 * 10;
lblpf.Text = PF.ToString();
Decimal gross = salary + DA + HRA ;
lblgross.Text = gross.ToString();
Decimal netpay = gross - PF ;
lblnetpay.Text = netpay.ToString();

}
{
Application.Exit();
}
{
txtsalary.Text = " ";
lblda.Text = " ";
lblhra.Text = " ";
lblpf.Text = " ";
lblgross.Text = " ";
lblnetpay.Text = " ";

Program 4:
{
combobox2.Items.Clear();
if (combobox1.SelectedItem == "FAMS")
{
combobox2.Items.Add("Accounting");
combobox2.Items.Add("Economics");
combobox2.Items.Add("Arabic");
combobox2.Items.Add("Hausa");
}
else
{
combobox2.Items.Add("computer science");
combobox2.Items.Add("cyber security");
combobox2.Items.Add("information technology");
combobox2.Items.Add("information system");
combobox2.Items.Add("software engineering");

}
}

You might also like