Thanks to visit codestin.com
Credit goes to github.com

Skip to content

hamim-ifty/BMICalculator

Repository files navigation

BMI Calculator

An Android application that calculates Body Mass Index (BMI) using Kotlin and Jetpack Compose.

Project Overview

This application calculates a user's BMI based on their height (in meters) and weight (in kilograms) using the formula: BMI = weight / (height * height).

The app features:

  • Input fields for height and weight
  • Real-time BMI calculation
  • BMI classification display (Underweight, Normal weight, Overweight, Obesity)
  • Color-coded classification results

Architecture

The project demonstrates the MVVM (Model-View-ViewModel) architecture pattern:

  • UI components built with Jetpack Compose
  • ViewModel to manage UI state and business logic
  • State management using mutableStateOf

Screenshots

Original Version (Without ViewModel)

Initial implementation without proper architecture.

Original BMI Calculator

Updated Version (With ViewModel)

Refactored version using proper MVVM architecture.

Updated BMI Calculator - Input Updated BMI Calculator - With Result

Implementation Details

  • ViewModel: Handles state management and BMI calculations
  • Compose UI: Modern declarative UI implementation
  • Data Validation: Proper handling of decimal inputs and empty values
  • BMI Classification: Classification based on WHO standards

BMI Classification Standards

  • Underweight: BMI < 18.5
  • Normal weight: 18.5 ≤ BMI < 25.0
  • Overweight: 25.0 ≤ BMI < 30.0
  • Obesity (Class 1): 30.0 ≤ BMI < 35.0
  • Obesity (Class 2): 35.0 ≤ BMI < 40.0
  • Obesity (Class 3): BMI ≥ 40.0

About

BMICalculator

Resources

Stars

Watchers

Forks

Languages