Guest User

Untitled

a guest
May 8th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. public double doCalories(boolean fem, boolean male, double age, double weight, double feet, double inches){
  2.  
  3. DisplayDateTime = (TextView)findViewById(R.id.date_test);
  4. calander = Calendar.getInstance();
  5. simpledateformat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
  6. Date = simpledateformat.format(calander.getTime());
  7. DisplayDateTime.setText(Date);
  8.  
  9.  
  10. double bmrResult = 0;
  11. double height_in_inches;
  12.  
  13. if (MainActivity.unit_is_gram){
  14. weight = weight * 2.2;
  15. }
  16.  
  17. if (MainActivity.unit_is_meter){
  18. height_in_inches = 0.39370* inches; //actually is 0.39370 * centimeters
  19. }
  20.  
  21. else height_in_inches = (feet*12)+inches;
  22.  
  23. if (fem == true) {
  24.  
  25. bmrResult = 10*(weight/2.2)+6.25*(height_in_inches*2.54)-5*age-161;
  26. }
  27.  
  28. else if (male == true){
  29.  
  30.  
  31. bmrResult = 10*(weight/2.2)+6.25*(height_in_inches*2.54)-5*age+5;
  32. }
  33.  
  34.  
  35.  
  36. return bmrResult;
  37. }
  38.  
  39. private static final String DATABASE_NAME = "UserManager.db";
  40.  
  41. // User table name
  42. private static final String TABLE_USER = "user";
  43.  
  44. // User Table Columns names
  45. private static final String COLUMN_USER_ID = "user_id";
  46. private static final String COLUMN_USER_NAME = "user_name";
  47. private static final String COLUMN_USER_EMAIL = "user_email";
  48. private static final String COLUMN_USER_PASSWORD = "user_password";
  49.  
  50.  
  51. // create table sql query
  52. private String CREATE_USER_TABLE = "CREATE TABLE " + TABLE_USER + "("
  53. + COLUMN_USER_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_USER_NAME + " TEXT,"
  54. + COLUMN_USER_EMAIL + " TEXT," + COLUMN_USER_PASSWORD + " TEXT" + ")";
Add Comment
Please, Sign In to add comment