• Post Reply Bookmark Topic Watch Topic
  • New Topic

arrays and boolean  RSS feed

 
kalthum munir
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
i'm trynna develop a house hiring system for school. I want to separate my hired houses from not hired ones using true for a hired house and false for open for sale. I was thinking boolean but I can't seem to get anywhere with it.
Can I get some help please its due in two days. Thanks.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kalthum munir wrote:Hello,


Hi, and welcome to the Ranch!

i'm trynna


Please UseRealWords(⇐click).

I want to separate my hired houses from not hired ones using true for a hired house and false for open for sale. I was thinking boolean

Yes, a boolean indicating hire/not hired is one valid approach.

but I can't seem to get anywhere with it.
Can I get some help please


Sure, people are happy to help. But you need to ShowSomeEffort(⇐click) and TellTheDetails(⇐click). Exactly what did you try, and exactly what problems did you have with it?

its due in two days. Thanks.


That's not relevant to anybody here, and bringing it up might put people off wanting to help you.
 
Campbell Ritchie
Marshal
Posts: 56541
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote: . . . Yes, a boolean indicating hire/not hired is one valid approach. . . .
Agree. But I would suggest a boolean[] would be a very poor approach.

And welcome again
 
kalthum munir
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but what do you suggest, sorry I am not being able to upload the code at the moment because I am trying to fix an exception error. But please I would take any ideas
 
Ashish Dutt
Ranch Hand
Posts: 172
Java MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there,
Seems like you have already got some intutive suggestions from Jeff and Campbell.
As they suggested it would be wiser if you "show us something" first so that we know what exactly are you trying to achieve
Hope this helps.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kalthum munir wrote:Thanks, but what do you suggest, sorry I am not being able to upload the code at the moment because I am trying to fix an exception error.


You can still upload it. If we don't know what you've tried we can't very well advise you on how to fix it now can we?
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:
Jeff Verdegan wrote: . . . Yes, a boolean indicating hire/not hired is one valid approach. . . .
Agree. But I would suggest a boolean[] would be a very poor approach.


I wouldn't necessarily say very poor. It's not how I would do it, but I figure let's take one step at a time.
 
kalthum munir
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my house hiring method:



and the attempt that I made which I have no idea what I just did myself.

I was thinking if a customer hires a house, the house should be saved in the hired house list(HiredL) and removed from my house array(hs). which I declared in my house class
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kalthum munir wrote:I want to separate my hired houses from not hired ones using true for a hired house and false for open for sale. I was thinking boolean...

Like others have said: without more info, it's hard to advise anything much.

I will say this though: It should almost certainly be part of a House class, so I hope you've created one.

...but I can't seem to get anywhere with it.

And for that we will need information.

Winston
 
Campbell Ritchie
Marshal
Posts: 56541
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote: . . . It should almost certainly be part of a House class, . . .
What do you mean by “almost”? Where else would you put it? I think it would be very () poor design to put it anywhere else.

Well, very probably anyway.

An alternative to a boolean would be an enumerated type.
 
kalthum munir
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for the help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!