Question: Android Studio Problem: a) Develop the BMI app and achieve the following features: 1) The user is able to switch between (kg, cm) and (lbs,
Android Studio Problem:
a) Develop the BMI app and achieve the following features:
1) The user is able to switch between (kg, cm) and (lbs, feet, inch) units;
2) If the user does not type in anything, remind the user to type in the numbers.
3) Depending on the BMI, show different warning messages to the user. For example, if BMI > 30, show Your BMI is XX; obesity!
4) Use method overloading when calculate the BMI. One method take two inputs (kg and cm) to calculate; the second method has the same method name and take three input (lbs, feet, and inch) to calculate the BMI.
Java code
src/MainActivity.java
(Paste your java code here)
XML code
res/layout/activity_main.xml
(Paste your xml code here)
b) Create a new class call PatientAccount. Create two variables: String name and double balance. Create getter and setter for these two fields. Create two different constructors for the two variables. One constructor to set default values for the variables. The other constructor takes two inputs from the user. Create two addition methods in the class: withdraw (double money) and deposit (double money): withdraw will reduce the balance by money and deposit will increase the deposit by money. If the balance is less than 0 when doing withdraw, print out the following message using System.out.println(): "cannot withdraw, balance too low".
class PatiantAccount { private String name; private double balance;
//Put your code here
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
