Concept explainers
I need to add 7 and 8 to my code below....
- Compare and contrast the array and arrayList.
- Give at least one example that describe when to use arrayList compared to an array.
package javaSvanos;
import java.util.Scanner;
public class module3project {
public static void main(String args[])
{
String name;
double weight;
int height_feet;
int height_inch;
String birth_date;
try (Scanner sc = new Scanner(System.in)) {
try
{
System.out.println("Hello! Please enter the name of the patient:\t");
name = sc.nextLine();
System.out.println("Please enter the weight of the patient (in lbs):\t");
weight = sc.nextInt();
System.out.println("Please enter the height of the patient (feet):\t");
height_feet = sc.nextInt();
System.out.println("Please enter the height of the patient (inches):\t");
height_inch = sc.nextInt();
sc.nextLine();
System.out.println("Please enter the patient's birthdate:\t");
birth_date = sc.nextLine();
int height = height_feet * 12 + height_inch;
double bmi = Math.round(((weight * 703)/(height * height))*10)/10;
double lbsweight=weight*2.20462262;
System.out.println("Patient's Name:\t" + name);
System.out.println("Patient's Weight:\t" + weight + " lbs");
System.out.println("Patient's Height:\t" + height_feet + " feets " + height_inch + " inches ");
System.out.println("Patient's Birth Date:\t" + birth_date);
if(bmi < 18.5)
{
System.out.println("Patient's BMI category is underweight and the insurance payment category is low.");
}
else if(bmi >= 18.5 && bmi < 24.9)
{
System.out.println("Patient's BMI Category is Normal and insurance payment category is low.");
}
else if(bmi >= 25 && bmi <= 29.9)
{
System.out.println("BMI Category is Overweight and insurance payment category is high.");
}
else
{
System.out.println("BMI Category is Obesity and insurance payment category is highest.");
}
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
System.out.println("Thank You for using the BMI Insurance Category application!");
}
}
}
}
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
here are the exact instructions for this project;:
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 Category.
- If the BMI Score is less than 18.5, then underweight.
- If the BMI Score is between 18.5-24.9, then Normal.
- If the BMI score is between 25 to 29.9, then Overweight.
- If the BMI score is greater than 29.9, then Obesity.
- Calculate Insurance Payment Category based on BMI Category.
- If underweight, then insurance payment category is low.
- If Normal weight, then insurance payment category is low.
- If Overweight, then insurance payment category is high.
- If Obesity, then insurance payment category is highest.
- Implement exception handling.
- 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.
- Create an interface called as the patient and then implement the interface as well as all the above methods.
- Store all the patient name in the queue data structure using the enqueue method and use the dequeue to remove patient name from the queue data structure and print it. You should notice the first in first out concept.
And what I have so far is:
package javaSvanos;
import java.util.Scanner;
public class module3project {
public static void main(String args[])
{
String name;
double weight;
int height_feet;
int height_inch;
String birth_date;
try (Scanner sc = new Scanner(System.in)) {
try
{
System.out.println("Hello! Please enter the name of the patient:\t");
name = sc.nextLine();
System.out.println("Please enter the weight of the patient (in lbs):\t");
weight = sc.nextInt();
System.out.println("Please enter the height of the patient (feet):\t");
height_feet = sc.nextInt();
System.out.println("Please enter the height of the patient (inches):\t");
height_inch = sc.nextInt();
sc.nextLine();
System.out.println("Please enter the patient's birthdate:\t");
birth_date = sc.nextLine();
int height = height_feet * 12 + height_inch;
double bmi = Math.round(((weight * 703)/(height * height))*10)/10;
double lbsweight=weight*2.20462262;
System.out.println("Patient's Name:\t" + name);
System.out.println("Patient's Weight:\t" + weight + " lbs");
System.out.println("Patient's Height:\t" + height_feet + " feets " + height_inch + " inches ");
System.out.println("Patient's Birth Date:\t" + birth_date);
if(bmi < 18.5)
{
System.out.println("Patient's BMI category is underweight and the insurance payment category is low.");
}
else if(bmi >= 18.5 && bmi < 24.9)
{
System.out.println("Patient's BMI Category is Normal and insurance payment category is low.");
}
else if(bmi >= 25 && bmi <= 29.9)
{
System.out.println("BMI Category is Overweight and insurance payment category is high.");
}
else
{
System.out.println("BMI Category is Obesity and insurance payment category is highest.");
}
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
System.out.println("Thank You for using the BMI Insurance Category application!");
}
}
}
}
And this was the teachers notes and feedback for this assignment if that helps.
here are the exact instructions for this project;:
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 Category.
- If the BMI Score is less than 18.5, then underweight.
- If the BMI Score is between 18.5-24.9, then Normal.
- If the BMI score is between 25 to 29.9, then Overweight.
- If the BMI score is greater than 29.9, then Obesity.
- Calculate Insurance Payment Category based on BMI Category.
- If underweight, then insurance payment category is low.
- If Normal weight, then insurance payment category is low.
- If Overweight, then insurance payment category is high.
- If Obesity, then insurance payment category is highest.
- Implement exception handling.
- 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.
- Create an interface called as the patient and then implement the interface as well as all the above methods.
- Store all the patient name in the queue data structure using the enqueue method and use the dequeue to remove patient name from the queue data structure and print it. You should notice the first in first out concept.
And what I have so far is:
package javaSvanos;
import java.util.Scanner;
public class module3project {
public static void main(String args[])
{
String name;
double weight;
int height_feet;
int height_inch;
String birth_date;
try (Scanner sc = new Scanner(System.in)) {
try
{
System.out.println("Hello! Please enter the name of the patient:\t");
name = sc.nextLine();
System.out.println("Please enter the weight of the patient (in lbs):\t");
weight = sc.nextInt();
System.out.println("Please enter the height of the patient (feet):\t");
height_feet = sc.nextInt();
System.out.println("Please enter the height of the patient (inches):\t");
height_inch = sc.nextInt();
sc.nextLine();
System.out.println("Please enter the patient's birthdate:\t");
birth_date = sc.nextLine();
int height = height_feet * 12 + height_inch;
double bmi = Math.round(((weight * 703)/(height * height))*10)/10;
double lbsweight=weight*2.20462262;
System.out.println("Patient's Name:\t" + name);
System.out.println("Patient's Weight:\t" + weight + " lbs");
System.out.println("Patient's Height:\t" + height_feet + " feets " + height_inch + " inches ");
System.out.println("Patient's Birth Date:\t" + birth_date);
if(bmi < 18.5)
{
System.out.println("Patient's BMI category is underweight and the insurance payment category is low.");
}
else if(bmi >= 18.5 && bmi < 24.9)
{
System.out.println("Patient's BMI Category is Normal and insurance payment category is low.");
}
else if(bmi >= 25 && bmi <= 29.9)
{
System.out.println("BMI Category is Overweight and insurance payment category is high.");
}
else
{
System.out.println("BMI Category is Obesity and insurance payment category is highest.");
}
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
System.out.println("Thank You for using the BMI Insurance Category application!");
}
}
}
}
And this was the teachers notes and feedback for this assignment if that helps.
- use java to create a card game with the implements listed for the program. If you are able to do the first couple of steps that would be helpful and for step one use an array list with the following code. The code below should create 52 cards. String[] suits = {"Hearts", "Clubs", "Spades", "Diamonds"}; String[] numbers = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"}; for(String oneSuit : suits){ for(String num : numbers){ System.out.println(oneSuit + " " + num); } }arrow_forwardpublic static void reverse(ArrayList<Integer> alist){}public static ArrayList<Integer> reverseList(ArrayList<Integer> alist){} How to use these two headers method and a main method to create the output of [1,2,3] [3,2,1]arrow_forwardSolution in Java Create a function that takes an array of increasing letters and return the missing letter. Examples missing Letter (["a", "b", "c", "e", "f", "g"]) → "d" missing Letter (["O", "Q", "R", "S"]) → "P"arrow_forward
- Write in Java What is this program's exact outputarrow_forwardJava language Use arrays in creating your class. Stack Interface (LIFO) void push(Object) Object pop() String toString() boolean isEmpty() boolean equals(Object) getIndexOf get remove private static void arrayListTests() { System.out.println("ArrayList Tests"); // todo: make more tests here ArrayList a = new ArrayList(); System.out.println("Check empty array isEmpty:" + a.isEmpty()); a.insert('B', 0); a.insert('a', 0); a.insert('t', 1); System.out.println("Check non-empty array isEmpty:" + a.isEmpty()); System.out.println(a.toString()); while (a.isEmpty() == false) { System.out.println(a.remove(0)); } // Fill over initial capacity and check that it grows for (int i = 0; i < 110; i++) { a.append(new Integer(i)); } System.out.println("Size of array after 110 adds: "+ a.size()); System.out.println("Value of last element: "+ a.get(a.size()-1)); System.out.println("Insert past end of list"); a.insert('z', 200); System.out.println("Insert negative index"); a.insert('z', -3);…arrow_forwardQuestion is in image providedarrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY