You are working as a software developer for a large insurance company. Your company is planning to migrate the existing systems from Visual Basic to Java and this will require new calculations. You will be creating a program that calculates the insurance payment category based on the BMI score.
Your Java program should perform the following things:
You need to submit the following things:
/********************************BMI.java*********************************************/
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
interface Patient {
public String displayBMICategory(double bmi);
public String displayInsuranceCategory(double
bmi);
}
public class BMI implements Patient {
public static void main(String[] args) {
/*
* local variable for saving the
patient information
*/
double weight = 0;
String birthDate = "", name =
"";
int height = 0;
Scanner scan = new
Scanner(System.in);
String cont = "";
Queue<String> patients = new
LinkedList<>();
// do while loop for keep
running program till user not entered q
do {
System.out.print("Press Y for continue (Press q for exit!)
");
cont =
scan.nextLine();
if
(cont.equalsIgnoreCase("q")) {
System.out.println("Thank you for using BMI
calculator");
break;
}
System.out.print("Please enter patient name: ");
/*
* try catch
block for valid data for weight catch block for null value
catch
* block for
divide by zero exception if height is zero finally block
*/
try {
name = scan.nextLine();
System.out.print("Please enter the weight of the
patient in kg: ");
weight = scan.nextDouble();
scan.nextLine();
System.out.print("Please entet the birth date of
patient: ");
birthDate = scan.nextLine();
System.out.print("Please enter the height of
patient in cm: ");
height = scan.nextInt();
scan.nextLine();
} catch
(NumberFormatException e) {
System.out.println("Please enter valid
data!");
} catch
(ArithmeticException e) {
System.out.println("Height can not be
zero!");
} catch
(NullPointerException e) {
System.out.println("Name can not be
blank!");
} finally
{
System.out.println("Welcome to BMI
calculator!!");
}
// calculate
height in meter
double
heightInMeter = (double) height / 100;
// calculate
BMI
double bmi =
weight / (heightInMeter * heightInMeter);
/*
* Print the
patient name and date of birth print the patient BMI category
print
* the patient
insurance payment category
*/
Patient patient
= new BMI();
patients.add(name);
System.out.println("Patient " + name + " and Date of birth is - " +
birthDate
+ "\nPatient BMI category is
- " + patient.displayBMICategory(bmi));
System.out.println("And Patient insurance payment category is - " +
patient.displayInsuranceCategory(bmi));
} while
(!cont.equalsIgnoreCase("q"));
System.out.println("WaitingQueue
: " + patients);
String patientName =
patients.remove();
System.out.println("Removed from
WaitingQueue : " + patientName + " | New WaitingQueue : " +
patients);
scan.close();
}
@Override
public String displayBMICategory(double bmi) {
String bmiCategory = "";
if (bmi <= 18.5) {
bmiCategory =
"underweight";
} else if (bmi > 18.5
&& bmi <= 24.9) {
bmiCategory =
"Normal";
} else if (bmi > 25
&& bmi <= 29.9) {
bmiCategory =
"Overweight";
} else if (bmi > 29.9)
{
bmiCategory =
"Obesity";
}
return bmiCategory;
}
@Override
public String displayInsuranceCategory(double bmi)
{
/*
* set Insurance Payment category as
BMI category
*/
String insuranceCategory =
"";
if (bmi <= 18.5) {
insuranceCategory = "Low";
} else if (bmi > 18.5 &&
bmi <= 24.9) {
insuranceCategory = "Low";
} else if (bmi > 25 &&
bmi <= 29.9) {
insuranceCategory = "High";
} else if (bmi > 29.9) {
insuranceCategory = "Highest";
}
return insuranceCategory;
}
}
/***********************************output*****************************************/
Press Y for continue (Press q for exit!) y
Please enter patient name: Vishal
Please enter the weight of the patient in kg: 78
Please entet the birth date of patient: 05/10/1993
Please enter the height of patient in cm: 180
Welcome to BMI calculator!!
Patient Vishal and Date of birth is - 05/10/1993
Patient BMI category is - Normal
And Patient insurance payment category is - Low
Press Y for continue (Press q for exit!) y
Please enter patient name: JKS
Please enter the weight of the patient in kg: 67
Please entet the birth date of patient: 03/04/1992
Please enter the height of patient in cm: 178
Welcome to BMI calculator!!
Patient JKS and Date of birth is - 03/04/1992
Patient BMI category is - Normal
And Patient insurance payment category is - Low
Press Y for continue (Press q for exit!) y
Please enter patient name: Messi
Please enter the weight of the patient in kg: 89
Please entet the birth date of patient: 05/11/1989
Please enter the height of patient in cm: 167
Welcome to BMI calculator!!
Patient Messi and Date of birth is - 05/11/1989
Patient BMI category is - Obesity
And Patient insurance payment category is - Highest
Press Y for continue (Press q for exit!) q
Thank you for using BMI calculator
WaitingQueue : [Vishal, JKS, Messi]
Removed from WaitingQueue : Vishal | New WaitingQueue : [JKS,
Messi]
Please let me know if you have any doubt or modify the answer,
Thanks :)
You are working as a software developer for a large insurance company. Your company is planning...
OGICAL 28. Body mass index (BMI) is a measure of obesity. In standard units, it is calculated by the formula EMENTS BMI = 7032 ATEMENT NESTED INTS where Wis weight in pounds, and His height in inches. The obesity classification is BMI Classification Below 18.5 Underweight 18.5 to 24.9 Normal 25 to 29.9 Overweight 30 and above Obese Tue Write a program in a script file that calculates the BMI of a person. The program asks the person to enter...
/////////////////////////////////////////////////////////////////////////////////// //This program // 1. asks the user her/his weight and height // 2. then calculates the user's body-mass-index (BMI) // 3. and then prints an appropriate message based on the user's BMI /////////////////////////////////////////////////////////////////////////////////// #include <iostream> using namespace std; void printWelcome(); // ask the weight (in pounds) and height (in inches) of the user and store the values in formal // parameters weight and height, respectively void getWeightAndHeight(float& weight, float& height); // calculate and return the BMI (Body-Mass-Index) based on...
read instructions carefully please matlab only Write a MATLAB function for a BMI calculator that receives the inputs for body weight (lbs)and height (ft) from the user's program, calculates the BMI using the equation below, displays the BMI category, and outputs the BMI value tothe user's program W (kg) h2 (m2) BMI Display Normal if 18.5 s BMI 25 Display Overweight if 25 s BMI <30 Display Obese if BMI 2 30 Else display underweight So you will create two...
javafx 1. Implement a BMI (Body Mass Index) server that will accept height and weight from the client, calculate the BMI and return a string with the BMI and a status (l.e. normal, over weight, etc.). Build a GUI using JavaFX. You are given a working BMI class that will do the BMI calculations, etc. A single BMI client connection is sufficient. 2. Implement a JavaFX BMI client that will allow the user to enter height (in inches), weight (in...
IT Java code In Lab 8, we are going to re-write Lab 3 and add code to validate user input. The Body Mass Index (BMI) is a calculation used to categorize whether a person’s weight is at a healthy level for a given height. The formula is as follows: bmi = kilograms / (meters2) where kilograms = person’s weight in kilograms, meters = person’s height in meters BMI is then categorized as follows: Classification BMI Range Underweight Less...
Please write this code in C++ Object-Oriented Programming, specify which files are .h, and .cpp, and please add comments for the whole code. Include a class diagrams, and explain the approach you used for the project and how you implemented that, briefly in a few sentences. Please note the following: -Names chosen for classes, functions, and variables should effectively convey the purpose and meaning of the named entity. - Code duplication should be avoided by factoring out common code into...
Y F G Prompt and Store. 5. Prompt the user with "Enter your weight in pounds: "message and store in the weight variable. 6. Initialize an int variable named heightIn Inches to feet OſHeight times 12 plus Inches OfHeight. 7. Initialize a double variable named BMI to weight * 703.0 heightIrinches El VB 8. Initialize a double variable named ratio to height In Inches? 703.0 9. Initialize a double variable named lower Normal to 18.5 times ratio. 10. Initialize a...
Design and implement an Employee Payment System using single inheritance. This system will support three types of employees that are technician, engineer and manager. An employee has basic information such as last name, first name, address, telephone number and social security number. Basic operations include set month payment rate, calculate annual salary and actual payment. Tax is deducted at 20% of total payment. The company allows a and overtime pay rate. If a manager does an excellent job the company...
+ Run C Code IMPORTANT: • Run the following code cell to create the input file, biostats.csv, which you will be using later. 74, In [ ]: N %%file biostats.csv Name, Sex, Age, Alex, M, 41, Bert, M, 42, Dave, M, 39, Elly, F, 30, Fran, F, 33, Jake, M, F, Luke, M, 34, F Myra, M, M, 38, Ruth, F, 28, 22 22 323 47 47, Height, Weight 170 200 167 70 115 143 139 280 98 75, 350...
Part I: Complete Your Original Response to the Main Topic You are a software developer for a Retail Point of Sale System Company. A client has made a request to upgrade the current system from command line interface to a graphic user interface. The client concerns on an effect to the current system with the change. The client does not want to lose any current data on the system. Provide recommendations and the change plan including the below requirements to...