Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I don\'t know what to do. Please help. Write an application program for the GYM

ID: 3830072 • Letter: I

Question

I don't know what to do. Please help.

Write an application program for the GYM and help the customers to find his/her BMI (body mass index), and BMI categories information.

There are four Java documents in Lab3_GYM folder: Personal_Info.java, BMI.java, Customer.java, GYMdriver.java. Some of them are unfinished. Please finish the whole GYM application program according to the following requirements:

BMI class:

     create FindBMI() method to return BMI value according to height and weight.

Customer class:

Create a constructor: Personal_Info and BMI both act as aggregation part for Customer. That means any customer has his personal information and BMI value

Create BMIcat() method to return BMI categories message according to different BMI value

Driver class: GYMdriver

create customer object

set or read his/her personal information

set or read his/her height and weight value

output his/her BMI value

output his/her BMI categories information

BMI.java

public class BMI
{
   private double height, weight;

   BMI(double height, double weight)
   {
       this.height = height;
       this.weight = weight;
   }

   BMI()
   {
       height = 0.0;
       weight = 0.0;
   }


   void setHeight(double updateHeight)
   {
       height = updateHeight;
   }

   void setWeight(double updateWeight)
   {
       weight = updateWeight;
   }
  
   double getHeight()
   {
       return height;
   }

   double getWeight()
   {
       return weight;
   }

   // 1. create FindBMI() method to return BMI value according to height and weight:   
  
  
   public String toString()
   {
       return "Height " + height + " Weight: " + weight;
   }
  


}

public class Customer
{
   private Personal_Info info;
   private BMI bmi;

   // 1. create a constructor:
   // Personal_Info and BMI both act as aggregation part for Customer
   // any customer has his personal information and BMI value
  


   // 2. create a method to return BMI categories message
   // according to different BMI value
  

  

}

Customer.java

public class Customer
{
   private Personal_Info info;
   private BMI bmi;

   // 1. create a constructor:
   // Personal_Info and BMI both act as aggregation part for Customer
   // any customer has his personal information and BMI value
  


   // 2. create a method to return BMI categories message
   // according to different BMI value
  

  

}

GYMdriver.java

import java.util.*;


public class GYMdriver{

   public static void main(String[] args)
   {
       Scanner scan = new Scanner(System.in);

// create customer object
// 1. set or read his/her personal information
// 2. set or read his/her height and weight value
// 3. output his/her BMI value
// 4. output his/her BMI categories information

      

       scan.close();
   }

}

Personal_Info.java

public class Personal_Info
{
   private String name, gender;
   private int age;

   Personal_Info(String name, int age, String gender)
   {
       this.name = name;
       this.age = age;
       this.gender = gender;
   }

   Personal_Info()
   {
       name = "";
       age = 0;
       gender = "";
   }

   void setAge(int updateAge)
   {
       age = updateAge;
   }

   void setName(String updateName)
   {
       name = updateName;
   }

   void setGender(String updateGender)
   {
       gender = updateGender;
   }

   int getAge()
   {
       return age;
   }
  
   String getGender()
   {
       return gender;
   }
  
   String getName()
   {
       return name;
   }

   public String toString()
   {
       return "Name " + name + " Age: " + age + " Gender: " + gender;
   }
}

Explanation / Answer

BMI.java

public class BMI {
   private double height, weight;
BMI(double height, double weight)
{
this.height = height;
this.weight = weight;
}
BMI()
{
height = 0.0;
weight = 0.0;
}

void setHeight(double updateHeight)
{
height = updateHeight;
}
void setWeight(double updateWeight)
{
weight = updateWeight;
}
  
double getHeight()
{
return height;
}
double getWeight()
{
return weight;
}
// 1. create FindBMI() method to return BMI value according to height and weight:
double FindBMI()
{
   return (703*weight)/(height*height);
}
  
public String toString()
{
return "Height " + height + " Weight: " + weight;
}
  
}

_________________

Customer.java

public class Customer {
   private Personal_Info info;
   private BMI bmi;
   // 1. create a constructor:
      
  
   // Personal_Info and BMI both act as aggregation part for Customer
   // any customer has his personal information and BMI value
   
       public Customer(Personal_Info info, BMI bmi) {
           super();
           this.info = info;
           this.bmi = bmi;
       }
   // 2. create a method to return BMI categories message
   // according to different BMI value
       //This function will Displays Weight status based on BMI value
       public String evaluate_bmi(double result)
       {
           String str = null;
       //Based on the BMI value Displays Weight status
       if(result<18.5)
       {
       str="Underweight";
       }
       else if(result>=18.5 && result<=24.9)
       {
           str="Normal";
       }
       else if(result>=25.0 && result<=29.9)
       {
       str="Overweight";
       }
       else if(result>=30.0)
       {
           str="Obese";
       }
       return str;
       }
  
  

}

________________________

Personal_Info.java

public class Personal_Info
{
private String name, gender;
private int age;
Personal_Info(String name, int age, String gender)
{
this.name = name;
this.age = age;
this.gender = gender;
}
Personal_Info()
{
name = "";
age = 0;
gender = "";
}
void setAge(int updateAge)
{
age = updateAge;
}
void setName(String updateName)
{
name = updateName;
}
void setGender(String updateGender)
{
gender = updateGender;
}
int getAge()
{
return age;
}
  
String getGender()
{
return gender;
}
  
String getName()
{
return name;
}
public String toString()
{
return "Name " + name + " Age: " + age + " Gender: " + gender;
}
}

_____________________

GYMdriver.java

import java.util.Scanner;

public class GYMdriver {
   public static void main(String[] args)
   {
       String name,gender;
       int age;
      
   Scanner scan = new Scanner(System.in);
   // create customer object
  
  
   System.out.print("Enter the Name :");
   name=scan.nextLine();
   System.out.print("Enter Gender :");
   gender=scan.next();
   System.out.print("Enter Age :");
   age=scan.nextInt();
  
   // 1. set or read his/her personal information
   Personal_Info info=new Personal_Info(name, age, gender);
  
   // 2. set or read his/her height and weight value
   System.out.print("Enter Height(in inches) :");
   int height=scan.nextInt();
   System.out.print("Enter Weight(in Pounds) :");
   int weight=scan.nextInt();
   BMI bmi=new BMI(height, weight);
   Customer c=new Customer(info, bmi);

       // 3. output his/her BMI value
   System.out.printf("Your MBI Value is :%.2f "+bmi.FindBMI());
  
       // 4. output his/her BMI categories information
   System.out.println("Your MBI Category :"+c.evaluate_bmi(bmi.FindBMI()));

   scan.close();
   }
}

_______________________

output:

Enter the Name :Kane Williams
Enter Gender :male
Enter Age :23
Enter Height( in Inches) :68
Enter Weight (in Pounds):141
Your MBI Value is :21.43
Your MBI Category :Normal

___________Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote