What happens when the view is clicked?
The code retrieves values from two input fields, performs division, and displays the result.
What constraints are applied to the 'aBox' EditText?
It is constrained to the parent layout and the 'bBox' EditText.
1/53
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.1
XML Layout for Android

What is the minimum height specified for the EditText fields?

48dp.

p.6
Input Validation

What is the input type specified for 'htBox'?

text

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 layout is being used in the provided XML code?

ConstraintLayout.

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.

p.5
XML Layout for Android

What layout is used in the activity_main.xml for the BMI Calculator?

ConstraintLayout.

p.1
User Input Handling

What is the purpose of the EditText with id 'aBox'?

To allow the user to enter a value.

p.1
User Input Handling

What type of input is specified for the EditText fields?

Text input.

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.5
User Input Handling

What input type is specified for the EditText 'wtBox'?

Text.

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.

p.5
BMI Calculation

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.6
XML Layout for Android

What is the text displayed in the TextView with id 'htLbl'?

Height (in Cm)

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.

p.6
Result Display

What is the purpose of the TextView with id 'result'?

To display the result of the calculation.

p.4
Input Validation

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).

p.5
User Input Handling

What is the hint provided in the EditText for weight input?

Enter Weight.

p.1
User Input Handling

What is the purpose of the 'bBox' EditText?

To allow the user to enter a second value.

p.7
Arithmetic Operations

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.

p.1
XML Layout for Android

What layout is used in the activity_main.xml file?

ConstraintLayout.

p.5
User Input Handling

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.

p.4
Result Display

What message is displayed if division by zero is attempted?

The message 'Division not possible' is displayed.

p.4
User Input Handling

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.3
Java Code Implementation

What is the package name of the MainActivity?

com.example.arith

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.

p.5
XML Layout for Android

What is the text displayed in the header of the BMI Calculator?

BMI Calculator.

p.1
Button Click Listeners

What does the Button with id 'addBtn' represent?

The addition operation.

p.7
XML Layout for Android

What layout is set for the MainActivity?

R.layout.activity_main.

p.7
BMI Calculation

What is the formula used to calculate BMI in the code?

BMI = weight / (height in meters * height in meters).

p.3
Java Code Implementation

Which class does MainActivity extend?

AppCompatActivity

p.3
Java Code Implementation

How are the EditText fields for input defined in MainActivity?

Using EditText aval and bval.

p.3
Java Code Implementation

What is the layout file used in setContentView?

R.layout.activity_main

p.1
Application Design

What is the aim of the experiment?

To design an application to perform arithmetic operations by reading input from the user.

p.7
User Input Handling

How is the weight value retrieved from the EditText?

Using wtval.getText().toString() and parsing it to Float.

p.7
Result Display

What are the BMI categories defined in the code?

Under Weight, Healthy, Over Weight, and Suffering from obesity.

p.3
Java Code Implementation

What method is overridden to set up the activity?

onCreate

p.3
Result Display

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.

p.3
Java Code Implementation

What data type are the variables 'a' and 'b'?

Double

Study Smarter, Not Harder
Study Smarter, Not Harder