CS201 MID TERM SOLVED MCQs || PAST PAPERS || GROUP-1 || INTRODUCTION TO PROGRAMMING || VuTech Visit Website For More Solutions www.vutechofficial.blogspot.com …
CS411 ASSIGNMENT NO. 2 FALL 2022 || 100% RIGHT SOLUTION || VISUAL PROGRAMMING || BY VuTech
Visit Website For More Solutions
www.vutechofficial.blogspot.com
SEND WHATSAPP OR E-MAIL FOR ANY QUERY
0325-6644800
kamranhameedvu@gmail.com
Please read all the instructions carefully
before attempting the assignment.
RULES FOR MARKING
It should be clear that your
assignment would not get any credit if:
The assignment is
submitted after the due date.
The submitted assignment
does not open or file is corrupt.
You have not used your own
student ID in code files and GIF file.
Student ID is not visible
in GIF file.
Strict action will be
taken if submitted solution is copied from any other student or from the
internet.
Lectures:
·Lectures 13 to 22 are covered in this assignment
NOTE
No
assignment will be accepted after the due date
via email in any case (whether it is the case of load shedding
or internet malfunctioning etc.). Hence refrain from uploading assignment in
the last hour of deadline. It is recommended to upload solution file at least
two days before its closing date.
If
you people find any mistake or confusion in assignment (Question statement),
please consult with your instructor before the deadline. After the deadline
no queries will be entertained in this regard.
For any query, feel free to email
at: cs411@vu.edu.pk
Output.GIF has been attached with this Assignment file. Please
observe this file carefully. Your program’s output must be like this output
file.
Submission
details:
Following files must be
submitted in a single zip or rar file.
Code files (Mainwindow.xaml and
Mainwindow.xaml.cs)
XML file (named as your (program VUid.xml)
A .gif file which shows the execution of your Application.
(For Recording .gif, a software namedScreentogif has
been uploaded on VULMS in the download section of this course , or you can use any other gif recording tool
as well)
You are not
required to submit the complete project, only copy these three files from
project folder. Please note if you submit doc file you will be awarded 0
marks.
Problem Statement:
The body mass index (BMI) is a
measure that uses your height and weight to work out if your weight is healthy.
BMI takes into account natural variations in body shape, providing a calculated
value for a healthy weight range for a particular height.
If your BMI is:
²below
18.5 – you're in the underweight range
²between 18.5
and 24.9 – you're in the healthy weight range
²between 25 and
29.9 – you're in the overweight range
²30 or
over – you're in the obese range
People who have overweight or obesity, compared to those with healthy weight,
are at increased risk for many serious diseases and health conditions. These
include:
High blood pressure (hypertension).
Type 2 diabetes.
Coronary heart disease.
Sleep apnoea and breathing problems.
Many
types of cancer.
Low quality of life.
Mental illness such as clinical
depression, anxiety, and other mental disorders.
Body pain and difficulty with physical
functioning.
Maintaining
a healthy weight is important for overall health and can help you prevent and
control many diseases and conditions.
Keep in view the above discussion, you are
required to create a C# WPF
application usingVisual Studio that calculates the Body
Mass Index with the following functional requirements:
Application
Interface:
When the application starts, the following screen should be displayed as shown in sample output below:
There should be your OWN VUID in RED color that should be visible at top left corner as shown in the sample output.
There should be two labels of “Height” and “Weight” along with two “text boxes” visible at the center of the screen similar to as shown in the sample output.
There should be a combo box button below the textbox of weight and it should contain two combo box items, “Standard” and “Metric” as shown in the sample output in .GIF file.
After the combo box, there should be a button labeled as “CalculateBMI” and another button labeled as “Clear”, similar to as shown in the sample output.
Below “CalculateBMI” button, there should be two labels, “Result” and “Comments” and in the horizontal space after these labels, there should be two hidden labels which will only be visible if the button “CalculateBMI” is clicked as shown in the sample output in .GIF file.
There should be a text block having text “MY BMI Calculator” rotated with an angle of 8 degrees at the righter space after the text boxes of Height and Weight, similar to as shown in the sample output.
The whole background should be colored of your own choice as shown in sample output. The buttons ”CalculateBMI” and “Clear” should have a background color of your own choice. The background color below your VUID should be different from the whole background color, as shown in the sample output.
You have to use the all the appropriate properties like margin, padding, font sizes, colors, font weights etc to make a similar application as shown in the sample output.
Execution Requirements:
Firstly, without entering any values in any text box, you have to click on the “CalculateBMI” button. So, on clicking the ”CalculateBMI” button, a message should be displayed having the text “please enter the height and weight”.
Then you will enter the height as 71 inches and weight as 150 pounds and click “CalculateBMI” button. After clicking the button, the hidden labels should be visible with correct values and comments. (No other input values will be considered in any case, so be careful and use only the mentioned values)
The Calculated BMI value should be rounded-off to only two fractional digits after the decimal.
Then you will select the combobox item to “Metric” on combo box without changing the values, (using same values as height = 71 CM and weight = 150 KG). On changing the combobox item to “Metric”, the labels of the Height (inches) and Weight (Pounds) should be changed to “Height (CM)” and “Weight (Kg)” as shown in the sample output in .GIF file.
Now, Click the “CalculateBMI” button again, the result and comments should change with correct BMI value and comments.
From the Calculated BMI value, you have to use the appropriate comment as per the following table:
Then you will click the “Clear” button. On clicking it, all the text boxes should be emptied and BMI value and BMI comments should be cleared and should be made hidden, same like they were hidden at the start of the application.
Formulas
for Calculating BMI:
For BMI in Standard: Use the following formula in your application for calculating BMI in Standard (I.e. Height in inches and Weight in Pounds)
BMI_in_Standard = 703 x (weight / (height x height));
For BMI in Metric: Use the following formula in your application for calculating BMI in Metric (I.e. Height in CM and Weight in KG)
BMI_in_Metric = 10000 x (weight / (height x height));
Important Note Regarding GIF:
Note: When you run your project,
start your .GIF recording only when your output window becomes visible (Do not
include any unnecessary part in .GIF file as it wastes time). Moreover, make
sure that your .GIF file should not be more than 10 to 15 seconds at maximum.
Best
of Luck!
SOLUTION
Program:
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace BMICalculator
{
public partial class MainWindow : Window
{
// Initialize variables for height, weight, and units
double height = 0;
double weight = 0;
string units = "Standard";
public MainWindow()
{
InitializeComponent();
// Set background color of application
Background = new SolidColorBrush(Color.FromRgb(240, 240, 240));
// Set background color of header
header.Background = new SolidColorBrush(Color.FromRgb(200, 200, 200));
// Set font size and weight of labels and buttons
labelHeight.FontSize = 18;
labelWeight.FontSize = 18;
labelResult.FontSize = 18;
labelComments.FontSize = 18;
labelResult.FontWeight = FontWeights.Bold;
labelComments.FontWeight = FontWeights.Bold;
buttonCalculate.FontSize = 18;
buttonClear.FontSize = 18;
// Set padding for labels and buttons
labelHeight.Padding = new Thickness(10);
labelWeight.Padding = new Thickness(10);
labelResult.Padding = new Thickness(10);
labelComments.Padding = new Thickness(10);
buttonCalculate.Padding = new Thickness(10);
buttonClear.Padding = new Thickness(10);
// Set background color of buttons
buttonCalculate.Background = new SolidColorBrush(Color.FromRgb(0, 122, 204));
buttonClear.Background = new SolidColorBrush(Color.FromRgb(255, 128, 128));
We provide Virtual University of Pakistan Study Materials such as Solution of Assignments, GDBs, Mid Term Solved Papers, Final Term Solved Papers, Mid Term Solved MCQs, and Final Term Solved MCQs. We also provide regular Semester Quizzes, Updated Handouts, and Short Questions and Answers. We help you with your research and many other educational-related topics, as far as we know. Furthermore, Share your problem with us and Please feel free to ask any related questions.