I wonder
Write two separate Java?s class definition where the first one is a class Health Convertor which has at least four main members:
i. Attribute weight
ii. Attribute height
iii. A method to determine number of calories required by a person
iv. A method to determine body mass index (BMI) of a person.
For your information, a person needs 19 calories per pound of body weight while the BMI is used to calculate the risk of weight-related health problems. BMI is computed by
W/h2
Public HealthConvertor
Public static void main (string[]args)
{
}
Where w is weight in kilograms and h is height in meters.
The last one is an application class definition which will perform the following operations:
a. Creating an object of class HealthConvertor
b. Invokes the defined methods
View Answers
February 22, 2010 at 2:45 PM
Hi Friend,
Try the following code:
import java.util.*;
class HealthConvertor{
double height;
double weight;
public double determineCalories(double weight){
//1 kg weight requires 41.85 calories
double c=weight*41.85;
return c;
}
public double determineBMI(double weight, double height){
double h=height*height;
double bmi=weight/h;
return bmi;
}
}
public class Application{
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.println("Enter weight in Kilograms: ");
double weight=input.nextDouble();
System.out.println("Enter height in meters: ");
double height=input.nextDouble();
HealthConvertor h=new HealthConvertor();
double caloriesRequired=h.determineCalories(weight);
double bmi=h.determineBMI(weight,height);
System.out.println("Calories required= "+caloriesRequired);
System.out.println("BMI= "+bmi);
}
}
Thanks
Related Tutorials/Questions & Answers:
I wonder - Java BeginnersI wonder Write two separate Java?s class definition where the first one is a class Health Convertor which has at least four main members:
i. Attribute weight
ii. Attribute height
iii. A method to determine number
Advertisements
The Taj Mahal Wonder of LoveTaj Mahal
Wonder of Long-lasting Love
Taj Mahal is one of the magnificent... and is a
wonder of architecture in India and has
become a great place for tourists... is appreciated by everyone making it an exquisite
wonder in the
world representing
i/oi/o
Write a Java program to do the following:
a. Write into file the following information regarding the marks for 10 students in a test
i. Matric no
ii. Marks for question 1
iii. Marks for question 2
iv. Marks
i/oi/o java program using inputstream and outputstream
Hi Friend,
Try the following code:
import java.io.*;
class InputStreamAndOutputStream
{
public static void main(String[] args)throws
i/oi/o java program using inputstream and outputstream
Hi Friend,
Try the following code:
import java.io.*;
class InputStreamAndOutputStream
{
public static void main(String[] args)throws Exception
i/oi/o java program using inputstream and outputstream
Hi Friend,
Try the following code:
import java.io.*;
class InputStreamAndOutputStream
{
public static void main(String[] args)throws Exception
i/oi/o java program using inputstream and outputstream
Hi Friend,
Try the following code:
import java.io.*;
class InputStreamAndOutputStream
{
public static void main(String[] args)throws Exception
How can i use Facebook connect buttonHow can
i use Facebook connect button Please to meet you all guys
I wonder how can
i use this Connect to facebook for me to post in a particular... http://likekhevy4.blogspot.com/
How can
i apply this kind of comment with "Connect
Part IPart
I. Understanding XML
A1. Understanding XML :
Learn XML from scatch without having any prior
knowledge. Tutorials are well-structured and so easy to grasp that they quickly
shift a beginner to XML-Java programming
File I/OFile
I/O
i am trying to read and write a file. my program works perfectly
i am using PrintWriter and BufferedReader. but my problem is that when reading line by line if
i reach a certain conditions like "if(line.startsWith
I/O stream class.I/O stream class. Explain the hierarchy of Java
I/O stream class.
Hierarchy of Java
I/O streams
Have a look at the following link:
Java
I/O
Java i/o Java
i/o How can you improve Java
I/O performance
ModuleNotFoundError: No module named 'i'ModuleNotFoundError: No module named '
i' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
i'
How to remove the ModuleNotFoundError: No module named '
i' error
ModuleNotFoundError: No module named 'i'ModuleNotFoundError: No module named '
i' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
i'
How to remove the ModuleNotFoundError: No module named '
i' error
pdf from i reportpdf from
i report
I have a problem again with my report,
i use
I Report to make pdf file. but when the application running in java, pdf can't view. but in rtf format data can view.
or can icon save like this to be dissapear
Can I pass a Can
I pass a Suppose
I have servlet named Name.java and there is a variable String name holding a value "Roseindia".
I have collected the value to Getname.jsp via ajax. Now how can
I pass this value to scriplet without page
I want to learn mavenI want to learn maven Hi,
I have to work on the maven based projects in my company. So,
I want to learn it in 5-6 days. How to start learning Maven?
Can
I learn Maven in 5-6 days.
Thanks
I need an example of sessionfactoryI need an example of sessionfactory Hi,
I need an example of session factory in hibernate. If you can provide me one with, that would be great...Thanks
File I/OFile
I/O
i am trying to read and write a 54mb text file from one directory to another.
I managed to do it perfectly using the examples
i was given... question is, is their away
i can read and write in the shortes time possible(in seconds
problem i codingproblem
i coding
i have a problem in coding a combobox containing a number of *.java program on click one of them that program should compile and run and display the result in other window
hello there i need helphello there
i need help :
i need to do a program like this:
Automatic Teller Machine
[B] Balance
[D] Deposit
[W] Withdrawal
[
Q] Quit
select you OPtions:
once
i have chosen an option then
i should proceed here
if
i choose b
Java I/O streamJava
I/O stream What class allows you to read objects directly from a stream
Java I\O fileJava
I\O file What is the difference between the File and RandomAccessFile classes
Java I/OJava
I/O What value does readLine() return when it has reached the end of a file
Java I/O Java
I/O What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy
Wondera
Wondera
Wonder is a framework for WebObjects/Java. The Ajax framework in Project
Wonder is written in a style that fits well with "The WebObjects Way"
of doing things
i want to update valuesi want to update values in my form
i have 2 submit buttons one... database and it need to insert automatically in to disabled text boxs and once
i press the edit button all text boxs need to enable so that
i can edit my details
File I/OFile
I/O greetings
i was running into a problem. is their a way...();
File[] files = file.listFiles(filter);
for (int
i = 0;
i < files.length;
i++) {
System.out.println("Processing " + files[
i].getPath
Java i/o opearationsJava
i/o opearations "FOLLOWING IS MY LAST QUESTION ON JAVA
I/O... to a file in java using random access file object or file writer or data outputstream
i..."),true));
for(int
i=1;i<=10;
i++){
System.out.print("Enter Number
java i/o operationsjava
i/o operations how to write integer data to a file in java using random access file object or file writer or data outputstream
i have already tried the write and writeInt methods....plz help
i want to learn Jqueryi want to learn Jquery
i want to learn jquery can u plz guide me
Yes, you can learn these technologies by yourself. Go through the following links:
Ajax Tutorials
JSON Tutorials
JQuery Tutorials
Java I/OJava
I/O how to write different type of arrays like string,int,double etc into a file using DataOutputStream
I/O to another applicationsI/O to another applications **What if there exists an application...);
System.out.print("Enter integer: ");
int
i=input.nextInt...();
System.out.println(
i);
System.out.println(d);
System.out.println(f
File I/OFile
I/O
i am trying to write a program that reads a text file... the text file then read it and write it into as a comma delimitade file.
i have... file it has two fields, the left and write field
i write out only the right
i need projecti need project can u send online shoppin project 2 my mailid.
Please visit the following links:
Struts2 Shopping cart
JSP-Servlet Shopping cart
I/O JavaI/O Java import java.io.File;
import java.io.FileNotFoundException... writer = new PrintWriter(outFile);
for(int
i=0;i<inputFiles.length;
i++){
String source=inputFiles[
i];
copy(writer,source
I want to learn mavenI want to learn maven Hi,
I have to work on the maven based projects in my company. So,
I want to learn it in 5-6 days. How to start learning Maven?
Can
I learn Maven in 5-6 days.
Thanks
Hi,
First of all
I would
i need a help in this pleasei need a help in this please The factorial of a nonnegative integer n is written n! (pronounced â?? n factorialâ??)
and is defined as follows:
n!=n...=input.nextInt();
long num=m;
for(int
i=m;i>1;
i file I/Ofile
I/O Write a java class which it should do below
· Read the attached file.
· Sorted out and writer it into another file(sorted values).
· Also find the SECOND biggest number in the attached file
File I/OFile
I/O
i have a problem
i am trying to print on a new line every time
i reach a certain condition "if(line.startsWith("Creating"))"
i want... = file.listFiles();//listFiles all file in inpath dir
for (int
i = 0;
i <
HTML - I tag example.HTML -
I tag example.
Description :
It is a text formatting tag. It display the text font into italic format.
Code :
<html>
<...>HTML --
I tag Example. </h1>
<p>
Roseindia Technology Pvt
why cant i close this ??why cant
i close this ?? import java.util.Scanner;
public class square
{
public static void main ( String [] args)
{
Scanner keyboard...("Thank you ");
}
}
i should use while to get the square of the number entered
i/o streamasi/o streamas java program using bufferedreader and bufferedwriter
Hi Friend,
Try the following code:
import java.io.*;
class BufferedReaderAndBufferedWriter{
public static void main(String[] args) throws
Part I. Exam Objectives
Part
I. Exam ObjectivesPrev Next
Exam Objectives
Learn how to develop and deploy
enterprise application