1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alexandra [31]
3 years ago
5

Create a java program using the following instructions:

Computers and Technology
1 answer:
Tom [10]3 years ago
6 0

Answer:

import java.util.Scanner;

public class HealthProfile  

{

private String name;

private int age;

private double weight;

private double height;

private double bmi;

private String category;

 

 

public void setName(String name)

{

 this.name = name;

}

public String getName()

{

 return name;

}

public void setAge(int age)

{

 this.age = age;

}

public int getAge()

{

 return age;

}

public void setWeight(double weight)

{

 this.weight = weight;

}

public double getWeight()

{

 return weight;

}

public void setHeight(double height)

{

 this.height = height;

}

public double getHeight()

{

 return height;

}

public void setBmi(double bmi)

{

 this.bmi = bmi;

}

public double getBmi()

{

 bmi = (weight * 703) / (height * height);

 return bmi;

}

public void setCategory(String category)

{

 this.category = category;

}

public String getCategory()

{

 if (bmi < 18.5){

  category = "underweight";

 } else if (bmi < 25){

  category = "normal";

 } else if (bmi < 30){

  category ="overweight";

 }else{

  category = "obese";

 }

 

 return category;

}

 

 

public static void main(String[] args)

{

Scanner input = new Scanner(System.in);

 

HealthProfile myHealthProfile = new HealthProfile();

System.out.println("This program reads in your data and calculates your Body Mass Index (BMI)");

System.out.println("Please enter your name: ");

String theName = input.nextLine();

myHealthProfile.setName(theName);

System.out.println("Please enter your age: ");

int theAge = input.nextInt();

myHealthProfile.setAge(theAge);

System.out.println("Please enter your weight in pounds: ");

double theWeight = input.nextDouble();

myHealthProfile.setWeight(theWeight);

System.out.println("Please enter your height in inches: ");

double theHeight = input.nextDouble();

myHealthProfile.setHeight(theHeight);

System.out.println();

System.out.println(theName);

System.out.printf("Your age is %s\n", myHealthProfile.getAge());

System.out.printf("Your weight is %s\n", myHealthProfile.getWeight(), "LBS");

System.out.printf("Your height is %s\n", myHealthProfile.getHeight());

System.out.printf("Your Body Mass Index (BMI) is %.2f\n", myHealthProfile.getBmi());

System.out.printf("You are %s\n", myHealthProfile.getCategory());

 

 

 

System.out.println();

System.out.printf("Name in object myHealthProfile is: %n%s%n", myHealthProfile.getName());

}

}  

You might be interested in
What layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for defining a way to interpret
sweet-ann [11.9K]

Answer:

The data-link layer

Explanation:

The physical layer and data-link layer are often confused a lot especially in terms of what they do in the TCP/IP 7 layer protocol. The physical layer as the name suggests represents the physical devices like the cables and the connectors that join or interconnect computers together. This layer is also responsible for sending the signals over to other connections of a network. The data-link, on the other hand, translates and interprets these sent binary signals so that network devices can communicate. This layer is responsible in adding mac addresses to data packets and encapsulating these packets into frames before being placed on the media for transmission. Since it resides in between the network layer and the physical layer, it connects the upper layers of the TCP/IP model to the physical layer.

3 0
4 years ago
Explain the role of ANY TWO components of the CPU
mars1129 [50]

Answer:

An <u>arithmetic logic unit</u> (ALU) is a digital circuit used to perform arithmetic and logic operations.

<u>The control unit</u> of the central processing unit regulates and integrates the operations of the compute

8 0
2 years ago
#Write a function called "in_parentheses" that accepts a
zimovet [89]

Answer:

import regex as re

def in_parentheses(a_string):

   regeX = re.compile(".*?\((.*?)\)")

   result = re.findall(regeX, a_string)

   return str(result).replace("[","").replace("]","")

print("test 1: "+in_parentheses("Open ( only"))

print("test 2: "+in_parentheses("This is a sentence (words!)."))

8 0
4 years ago
What is a potential benefit of using a VPN? Select one: a. You could increase your level of privacy by guarding your real IP add
Alik [6]

Answer:

d. All of these.

Explanation:

A VPN is an acronym for Virtual Private Network and it's a secured, encrypted and private web-based service used for accessing region-restricted and censored internet content. A VPN protects web data from potential hackers and government surveillance by hiding the real IP address of the host and encrypting user's internet traffic.

Basically, the VPN is a computer software that enables internet users to create a secured connection (sends and receives data) over public or shared networks like they're directly connected to the private network.

The potential benefits of a VPN service are;

- It increases privacy level by guarding the real IP address on the Internet.

- It protects user data exchange on a public Wi-Fi network by encryption.

- It can be used to securely connect to a corporate or personal network from far away through the Internet and access local resources.

8 0
4 years ago
I want to do is speed test to do i go to for my computer
laiz [17]

I just go to the speed test on my browser

7 0
3 years ago
Other questions:
  • Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate
    10·2 answers
  • How can ASCII be used to represent characters in a computer system?
    15·1 answer
  • Select the correct text in the passage.
    5·1 answer
  • 2. What's the keyboard command that will allow you to "copy" text?
    8·2 answers
  • PLEASEEEEEEEEEEEEEEEEE HELPPPPPPPP
    15·1 answer
  • In printing systems using ____, a disk accepts output from several users and acts as a temporary storage area for all output unt
    14·1 answer
  • The next four octal numbers after 36 is:________.
    10·1 answer
  • Which of the following is Microsoft’s fastest, most efficient operating system to date: a. Offering quicker application start up
    14·1 answer
  • Greedy Algorithm Design
    8·1 answer
  • . 。 • ゚ 。 .
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!