Question

In: Computer Science

You are working as a software developer for a large insurancecompany. Your company is planning...

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:

  1. Take the input from the user about the patient name, weight, birthdate, and height.

  2. Calculate Body Mass Index.

  3. Display person name and BMI Category.

    1. If the BMI Score is less than 18.5, then underweight.

    2. If the BMI Score is between 18.5-24.9, then Normal.

    3. If the BMI score is between 25 to 29.9, then Overweight.

    4. If the BMI score is greater than 29.9, then Obesity.

  4. Calculate Insurance Payment Category based on BMI Category.

    1. If underweight, then insurance payment category is low.

    2. If Normal weight, then insurance payment category is low.

    3. If Overweight, then insurance payment category is high.

    4. If Obesity, then insurance payment category is highest.

  5. Implement exception handling.

  6. Store all the information in the file. You need to use the loop and keep asking users to enter patient name, height, weight, and birthdate. Your program should calculate BMI Category and Insurance payment category and write it to the file. Your program should stop once user enter q character.

You need to submit the following things:

  • An entire Java solution

  • An output screenshot created using Microsoft Word

Solutions

Expert Solution

Code


import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;


public class BMI
{
public static void main(String[] args) throws FileNotFoundException, IOException
{
String name,date,bmiStatus,insuranceStatus;
double weight,height,BMI;
Scanner sc=new Scanner(System.in);
File fout = new File("out.txt");
   FileOutputStream fos = new FileOutputStream(fout);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
while(true)
{
System.out.print("Enter the name of the patient (or q to stop): ");
name=sc.next();
if(name.equalsIgnoreCase("q"))
break;
  
System.out.print("Enter the birth date of the patient (dd/mm/yyyy): ");
date=sc.next();
  
System.out.print("Enter the weight of the patient (in pound): ");
weight=sc.nextDouble();
  
System.out.print("Enter the height of the patient (in inches): ");
height=sc.nextDouble();
  
BMI= weight * 730 /(height * height);
if(BMI<18.5)
{
bmiStatus="underweight";
insuranceStatus="low";
}
else if (BMI>=18.5 && BMI<=24.9 )
{
bmiStatus="Normal";
insuranceStatus="low";   
}
else if (BMI>=25 && BMI<=29.9 )
{
bmiStatus="Overweight";
insuranceStatus="high";   
}
else
{
bmiStatus="Obesity";
insuranceStatus="highest";
}
String strDouble = String.format("%.2f", BMI);
System.out.println("BMI index calculated and write to file succesfull to file.");
bw.write("Patient Name: "+name+"\r\n"+"Birth Date: "+date+"\r\nBMI Index: "+strDouble+"\r\nBMI Category: "+bmiStatus+"\r\nInsurance payment category is:" +insuranceStatus);
bw.newLine();
bw.newLine();
System.out.println("");
  
}
bw.close();
}
  
}
output

text file


Related Solutions

You are working as a software developer for a large insurance company. Your company is planning...
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: Take the input from the user about the patient name, weight, birthdate, and height. Calculate Body Mass Index. Display person name and BMI...
You are working as the software developer and need to identify the best sorting algorithm. You...
You are working as the software developer and need to identify the best sorting algorithm. You can pick any two-sorting algorithm. You need to determine which sorting algorithm is the best to sort the array of 10k elements. Use the following steps to help with your solution: Create C++ functions for any two-sorting algorithm. Write down the random array generation function to generate at least 10k elements. Pass the same array into both the sorting algorithm. Calculate the end transactiontime-start...
You are working as an assistant in a design office. A developer in your local area...
You are working as an assistant in a design office. A developer in your local area has contacted your company looking for advice as to what would be a suitable project to meet the needs of the local community but also be a profitable investment. The developer is considering a number of different sites in the area. please research your local area(Hong Kong) and select an appropriate construction-based project. Topic:Minimising risk through design and specification P8 Utilise appropriate forms of...
Create a company that should be related to your major(SOFTWARE DEVELOPER) in some way or directly...
Create a company that should be related to your major(SOFTWARE DEVELOPER) in some way or directly related to your plans for the future. Once you know what that company will be and have laid out some ideas about what you will need in terms of office For this discussion board post, you need to choose three countries on three different continents and research some basic information about them with regard to starting or developing a business there. What are the...
Company is Apple Apple (who you are - Software developer) (Team you manage – App management...
Company is Apple Apple (who you are - Software developer) (Team you manage – App management ). What type of training do your employee needs? Why do they need training? Need Analysis info Determine an instructional scenario where new or revised training is appropriate; where there is an obvious gap between knowledge and performance. Determine what techniques you will use to gather data to substantiate the instructional need (surveys,questionnaires, interviews, etc). Develop a needs assessment instrument. Survey your target population/gather...
Comapny is APPLE, Inc Summarize the company. - Apple (who you are - Software developer) (Team...
Comapny is APPLE, Inc Summarize the company. - Apple (who you are - Software developer) (Team you manage – App management ). What type of training do your employee needs? Why do they need training? Need Analysis info Determine an instructional scenario where new or revised training is appropriate; where there is an obvious gap between knowledge and performance. Determine what techniques you will use to gather data to substantiate the instructional need (surveys,questionnaires, interviews, etc). Develop a needs assessment...
Choice 1. You are the new software developer at work. You are brought into a meeting...
Choice 1. You are the new software developer at work. You are brought into a meeting with clients that do not understand the idea of sorting data. Now you know, that you cannot use complex math to explain, but you can illustrate in diagrams. Basically, this group has been working with unsorted data and you must explain why their searches and reports will be so much faster with sorted data. You do not know anything specific about their data, but...
Assume that you are working for a company that develops software systems for in-house use in...
Assume that you are working for a company that develops software systems for in-house use in its design of aircraft engines. Being a software engineer you may not have any expertise in aircraft engines. While testing programs for such applications, what are the challenges you are likely to face, and how will you overcome them?
You are working for a company that is planning to invest in a foreign country. Management...
You are working for a company that is planning to invest in a foreign country. Management has requested a report regarding the attractiveness of alternative countries based on the potential return of foreign direct investment (FDI). A colleague mentioned a potentially useful tool called the FDI Confidence Index, which is updated periodically. Find this index online and analyze how the index is constructed. Discuss the countries that are ranked in the top 20 based on the FDI Confidence Index using...
Scenario You are the manager of a software development team working on new applications for your...
Scenario You are the manager of a software development team working on new applications for your company, Optimum Way Development, Inc. Your director has called for all development teams to submit product briefs detailing their current projects. The director plans to share the most promising product briefs with clients at an upcoming meeting. You have software design documents for two potential projects. Directions You must choose one of the potential products and use the information contained in the technical specification...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT