954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Java Syntax Help...I Cant Figure out what I'm Doing Wrong!!!PLEASE HELP

public class HealthProfile
{
private String healthfirstName;
private String healthlastName;
private String gender;
private Float birthday;
private Float weight;
private Float height;
private Double maximumheartrate;
private Double targetheartrate;
private Double bmi;

//starter
public void setHealthfirstname( String name )
{
healthfirstName = firstname;
}

public String getHealthfirstname()
{
return healthfirstName;
}

public void setHealthlastname( String name )
{
healthlastName = lastname;
}

public String getHealthlastname()
{
return healthlastName;
}

public void setHealthGender( String name )
{
gender = sex;
}

public String getHealthGender( String name )
{
return gender;
}

public void setBirthdate( float amount )
{
birthday = dateofbirth;
}

public float getBirthdate()
{
return birthday;
}

public void setWeight( float amount )
{
weight = weight1;
}

public float getWeight()
{
return weight;
}

public void setHeight( float amount )
{
height = height1;
}

public float getHeight()
{
return height;
}
public void Age( double amount )
{
age = 2010 - birthday;
}

public double getAge()
{
return age;
}

public void MaximumHeartrate( double amount )
{
maximumheartrate = 220-birthday;
}

public double getMaximumHeartrate()
{
return maximumheartrate;
}

public void TargetHeartrate( double amount )
{
targetheartrate = maximumheartrate/85;
}

public double getTargetHeartrate()
{
return targetheartrate;
}

public void BMI( double amount)
{
bmi = (weight * 703) / (height * height);
}

public double getBmi()
{
return bmi;
}
}

and here are the errors...PLEASE HELP....
HealthProfile.java:17: cannot find symbol
symbol : variable firstname
location: class HealthProfile
healthfirstName = firstname;
^
HealthProfile.java:27: cannot find symbol
symbol : variable lastname
location: class HealthProfile
healthlastName = lastname;
^
HealthProfile.java:37: cannot find symbol
symbol : variable sex
location: class HealthProfile
gender = sex;
^
HealthProfile.java:47: cannot find symbol
symbol : variable dateofbirth
location: class HealthProfile
birthday = dateofbirth;
^
HealthProfile.java:57: cannot find symbol
symbol : variable weight1
location: class HealthProfile
weight = weight1;
^
HealthProfile.java:67: cannot find symbol
symbol : variable height1
location: class HealthProfile
height = height1;
^
HealthProfile.java:76: cannot find symbol
symbol : variable age
location: class HealthProfile
age = 2010 - birthday;
^
HealthProfile.java:81: cannot find symbol
symbol : variable age
location: class HealthProfile
return age;
^
HealthProfile.java:86: incompatible types
found : float
required: java.lang.Double
maximumheartrate = 220-birthday;
^
HealthProfile.java:106: incompatible types
found : float
required: java.lang.Double
bmi = (weight * 703) / (height * height);

dbanks4271
Newbie Poster
6 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

Please use [code] tags.

Basically, you're using a bunch of variables that don't exist. What's firstName? You haven't declared any of those variables.

The incompatible types errors can be solved by casting the result to a float. If there's no particular reason, you may want to use a double, though.

coil
Posting Whiz in Training
273 posts since Aug 2010
Reputation Points: 27
Solved Threads: 56
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: