loop error
Howdy - am in the process of creating a program where a user enters the number of people in their family. The loop is suppose to loop the number of member in their family.. I got it to loop but it gives me a error stating that the int needs to be a boolean.. i am not really sure what it asking me.
please get back with me either by post of via email
patricia.feaster@lackland.af.mil
I could send what I have thus far.. i think its about 1/2 done, but its due by friday. thank you much for your time and I look forward to hearing from you.
VR
P.feaster
Howdy - am in the process of creating a program where a user enters the number of people in their family. The loop is suppose to loop the number of member in their family.. I got it to loop but it gives me a error stating that the int needs to be a boolean.. i am not really sure what it asking me.
for(int count = 1; count < familyMembers; count--)
System.out.println("enter member one's first name, last name, age, weight, height.");
firstName1 = keyboard.next();
lastName1 = keyboard.next();
age1 = keyboard.nextInt();
weight1 = keyboard.nextInt();
height1 = keyboard.nextInt();
if(count = 2)
System.out.println("enter member two's first name, last name, age, weight, height.");
firstName2 = keyboard.next();
lastName2 = keyboard.next();
age2 = keyboard.nextInt();
weight2 = keyboard.nextInt();
height2 = keyboard.nextInt();
I did that all the way to six.. we have not covered arrays so I do not think i can work ahead.
the whole program is to take all family info and avgerage out the age, weight, height; tell who is the oldest, tallest, & fatest.
I could send what I have thus far.. i think its about 1/2 done, but its due by friday. thank you much for your time and I look forward to hearing from you.
VR
P.feaster
> Howdy - am in the process of creating a program where
> a user enters the number of people in their family.
> The loop is suppose to loop the number of member in
> their family.. I got it to loop but it gives me a
> error stating that the int needs to be a boolean.. i
> am not really sure what it asking me.
>
Always post the full exact error message when asking for help.
I am guessing the problem is in this lineif(count = 2)
In java, there is a difference between the assignment operator = and the comparison operator ==. You are assigning count to 2, which produces an int value, but the if statement requires a boolean value. You need to use == for comparisons to produce a boolean value.