p.4
Button Click Listeners
What happens when the view is clicked?
The code retrieves values from two input fields, performs division, and displays the result.
p.1
XML Layout for Android
What constraints are applied to the 'aBox' EditText?
It is constrained to the parent layout and the 'bBox' EditText.
p.3
Button Click Listeners
What is the purpose of the add button's OnClickListener?
To perform addition of two numbers.
p.3
Button Click Listeners
What operation does the sub button perform?
Subtraction of two numbers.
p.2
XML Layout for Android
What is the significance of 'tools:layout_editor_absoluteX' and 'tools:layout_editor_absoluteY'?
These attributes are used for design-time layout positioning in the editor, not affecting runtime behavior.
What is the purpose of the EditText with id 'aBox'?
To allow the user to enter a value.
p.6
Button Click Listeners
What does the 'Button' with id 'calcBtn' do?
It triggers the calculation when clicked.
p.2
XML Layout for Android
What does the 'android:text' attribute specify in a Button?
It sets the text displayed on the Button.
p.4
Button Click Listeners
What does the setOnClickListener method do in this code?
It sets a listener for click events on the specified view.
p.2
XML Layout for Android
What is the purpose of the 'app:layout_constraintTop_toBottomOf' attribute?
It defines the vertical positioning of a view relative to another view below it.
What is the aim of the application designed in Experiment 2?
To calculate the body mass index (BMI) by reading input from the user.
p.6
XML Layout for Android
What is the purpose of the 'EditText' with id 'htBox'?
It allows users to enter their height.
p.7
Button Click Listeners
What happens when the calculate button is clicked?
It calculates the BMI and updates the result TextView based on the value.
What is the purpose of the TextView with id 'result'?
To display the result of the calculation.
What is checked before performing the division?
The code checks if 'b' is not equal to zero.
p.5
XML Layout for Android
What does the TextView with id 'wtLbl' represent?
It represents the label for weight input (in Kg).
What is the purpose of the 'bBox' EditText?
To allow the user to enter a second value.
How is height converted from centimeters to meters in the code?
By dividing the height value by 100.
p.2
XML Layout for Android
What does the 'android:layout_width' attribute control?
It controls the width of the view.
What is the purpose of the EditText with id 'wtBox'?
To allow the user to enter their weight.
p.7
Java Code Implementation
What is the purpose of the MainActivity class in the provided code?
It serves as the main entry point for the BMI calculation application.
p.6
XML Layout for Android
What layout attribute is used to align 'htLbl' to the start of the parent?
app:layout_constraintStart_toStartOf="parent"
p.2
XML Layout for Android
What does the 'wrap_content' value mean for layout dimensions?
It means the view will size itself to fit its content.
What message is displayed if division by zero is attempted?
The message 'Division not possible' is displayed.
How are the input values retrieved in this code?
Using Double.parseDouble() on the text from the input fields.
p.6
XML Layout for Android
What does the attribute 'app:layout_constraintBottom_toTopOf="@+id/htBox"' do?
It constrains the bottom of the view to the top of the height input box.
p.2
XML Layout for Android
How is the 'result' TextView positioned in relation to the 'divBtn' Button?
It is positioned below the 'divBtn' Button.
p.2
XML Layout for Android
What does the 'app:layout_constraintEnd_toEndOf' attribute do?
It aligns the end of the view to the end of the specified parent or sibling view.
What is the formula used to calculate BMI in the code?
BMI = weight / (height in meters * height in meters).
p.3
Java Code Implementation
How are the EditText fields for input defined in MainActivity?
Using EditText aval and bval.
What is the aim of the experiment?
To design an application to perform arithmetic operations by reading input from the user.
How is the weight value retrieved from the EditText?
Using wtval.getText().toString() and parsing it to Float.
What are the BMI categories defined in the code?
Under Weight, Healthy, Over Weight, and Suffering from obesity.
How is the result displayed in the TextView?
Using res.setText() method.
p.3
Button Click Listeners
What is the purpose of the mul button's OnClickListener?
To perform multiplication of two numbers.
p.6
XML Layout for Android
What does 'app:layout_constraintEnd_toEndOf="parent"' achieve?
It aligns the end of the view to the end of the parent layout.