boolean Help
I have a homework to be done tomorrow.
This is the case I Have few product product1, product 2, product3, etc...
I want to show product 1 is no saled yet and the last two that already selled i use the boolean because this provide yes and no how i do this this is what i have done!!!
publicboolean getProductonSale(){
return onSale;
}
publicboolean isSaled(){
// TODO Auto-generated method stub
returnfalse;
}
If i use return false it show me all NO i want a product with yes and the rest with no
This is the other part
if(productOne.isSaled() ==true){
System.out.print("On Sale: YES");
}else{
System.out.print("On Sale: NO");
}
[1366 byte] By [
hp369a] at [2007-10-2 18:25:53]

The "return false;" is just autogenerated code that will compile. It's not really supposed to be correct.
Your job is to replace that with stuff that is correct.
You probably want to hold the "saled" state in a boolean variable, like you are with "onSale". Or perhaps it should be derived from other state.
I don't know. It depends on what the program is supposed to do, etc., such as what the difference is between "production sale" and "saled".
I solve the problem
This is the correct
public boolean isSaled() {
// TODO Auto-generated method stub
return onSale;
}
public boolean isSaled() {
// TODO Auto-generated method stub
return false;
}
hp369a at 2007-7-13 19:46:56 >
