mpare 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;

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need to add 7 and 8 to my code below....

  1. Compare and contrast the array and arrayList.
  2. 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!");
                    }
                }
                }
        }
    

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

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:

 

  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.
  4. If the BMI Score is less than 18.5, then underweight.
  5. If the BMI Score is between 18.5-24.9, then Normal.
  6. If the BMI score is between 25 to 29.9, then Overweight.
  7. If the BMI score is greater than 29.9, then Obesity.
  8. Calculate Insurance Payment Category based on BMI Category.
  9. If underweight, then insurance payment category is low.
  10. If Normal weight, then insurance payment category is low.
  11. If Overweight, then insurance payment category is high.
  12. If Obesity, then insurance payment category is highest.
  13. Implement exception handling.
  14. 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.
  15. Create an interface called as the patient and then implement the interface as well as all the above methods.
  16. 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.

 

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Recurrence Relation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY