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

Programming Activities_Ordoñez

The document outlines a series of programming tasks in C# for a student named Juan Carlos G. Ordoñez. It includes creating programs for data input and display, employee information management, mathematical operations, and various calculations such as BMI and averages. Each task specifies the required inputs, expected outputs, and includes notes for handling specific conditions.

Uploaded by

osbornejc20
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 Activities_Ordoñez

The document outlines a series of programming tasks in C# for a student named Juan Carlos G. Ordoñez. It includes creating programs for data input and display, employee information management, mathematical operations, and various calculations such as BMI and averages. Each task specifies the required inputs, expected outputs, and includes notes for handling specific conditions.

Uploaded by

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

Ordoñez, Juan Carlos G.

BSCS - 2B

1. Declare these data types with corresponding variable and values, using a single Button print each using
labels:
Answer:

2. Create a C# program that allows you to input and display information about employees in a company. The
program should perform the following tasks:

Your program will ask the user to type these data: Employee ID, First Name, Middle Name, Last Name,
Age, and Salary. And display these data in your own way of creativity.

Note: If your employee ages below 18, message box will prompt with a message “You are not allowed to
work yet”.
3. Create a program that willtake:
 First Name, Last Name, and Middle Name.
 Barangay, Municipality, and Province.
 Birthday: Day, Month, and Year.
Note: The collected data will be displayed in a Message Box and the age must be automatically computed.
Example: Hello, you are John Randolf M. Penaredondo from Malaking Ambling, Magdalena, Laguna, born
on October 19, 1999, and you are now 23 years old.

Answer:

4. Create a program that identify whether a letter is a Vowel or Consonant, Display the answer in a message
box.

Answer:
5. Create a program that identify whether a number is Positive, Negative, and Zero. You can freely display the
output on your own ways.

Answer:

6. Create a program that identify whether a number is Odd or Even, Display the answer in a message box.

Answer:
7. Create a program that that will compare three numbers and will display the greatest number in a message
box.

Answer:
8. Create a program that will compute the mean average of 5 subjects: Filipino, Math, English, Science, and
Programming. The average grade will be displayed in a message box with its equivalent grade.
 100-99= 1.00
 98-96= 1.25
 95-93= 1.50
 92-90= 1.75
 89-87= 2.00
 86-84= 2.25
 83-81= 2.50
 80-78= 2.75
 77-75= 3.00
 74-70= 5.00

 If one subject has no grade it prints the average and the word “Incomplete”

Answer:
9. Create a program that calculates a person's body mass index (BMI) and classifies their weight status as
underweight, normal weight, overweight, or obese based on the following table:

BMI WEIGHT STATUS


Less than 18.5 Underweight
18.5- 24.9 Normal weight
25.0-29.9 Overweight
More than 30.0 Obese
Note: The BMI and weight status will be displayed in a Message box.
BMI= WEIGHT (KG) / HEIGHT (M)2

Answer:
10. Create a program that converts meters into different type of measurements (Inches, Feet, Yard, Miles).
Theprogram willasktheusertoselectinaradiobuttonofwhatmeasurementshouldthe metertobe
converted. Display the converted measurement in a label.

1 Meter 39.37 inches


1 Meter 3.28 feet
1 Meter 1.09 yard
1 Meter 1.62 s

Answer:
11. Create a program that will take two numbers and will perform these operations: Addition, Subtraction,
Multiplication, Division, and Modulus.
Note: The results should take decimal points.

Answer:

private void button1_Click(object sender, EventArgs e)


{
try
{
decimal num1 = decimal.Parse(textBox1.Text);
decimal num2 = decimal.Parse(textBox2.Text);
decimal result = num1 + num2;
textBox3.Text = $"Result: {num1} + {num2} = {result}";
}
catch (FormatException)
{
textBox3.Text = "Please enter valid numeric values.";
}
catch (Exception ex)
{
textBox3.Text = $"An error occurred: {ex.Message}";
}
}

private void button2_Click(object sender, EventArgs e)


{
try
{
decimal num1 = decimal.Parse(textBox1.Text);
decimal num2 = decimal.Parse(textBox2.Text);
decimal result = num1 - num2;
textBox3.Text = $"Result: {num1} - {num2} = {result}";
}
catch (FormatException)
{
textBox3.Text = "Please enter valid numeric values.";
}
catch (Exception ex)
{
textBox3.Text = $"An error occurred: {ex.Message}";
}
}

private void button3_Click(object sender, EventArgs e)


{
try
{
decimal num1 = decimal.Parse(textBox1.Text);
decimal num2 = decimal.Parse(textBox2.Text);
decimal result = num1 * num2;
textBox3.Text = $"Result: {num1} * {num2} = {result}";
}
catch (FormatException)
{
textBox3.Text = "Please enter valid numeric values.";
}
catch (Exception ex)
{
textBox3.Text = $"An error occurred: {ex.Message}";
}
}
private void button4_Click(object sender, EventArgs e)
{
try
{
decimal num1 = decimal.Parse(textBox1.Text);
decimal num2 = decimal.Parse(textBox2.Text);
decimal result = num1 / num2;
textBox3.Text = $"Result: {num1} / {num2} = {result}";
}
catch (FormatException)
{
textBox3.Text = "Please enter valid numeric values.";
}
catch (Exception ex)
{
textBox3.Text = $"An error occurred: {ex.Message}";
}
}

private void button5_Click(object sender, EventArgs e)


{
try
{
decimal num1 = decimal.Parse(textBox1.Text);
decimal num2 = decimal.Parse(textBox2.Text);
decimal result = num1 % num2;
textBox3.Text = $"Result: {num1} % {num2} = {result}";
}
catch (FormatException)
{
textBox3.Text = "Please enter valid numeric values.";
}
catch (Exception ex)
{
textBox3.Text = $"An error occurred: {ex.Message}";
}
}
}
}

You might also like