• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help me finish my exercise

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


here is what i already try
here is my interface

my dog class

my SecuritySystem class


and i have trouble when i try to make method in the house class


i don't know how to do what the exercises want

c) Add a public method called setAlarmsEnabled(Boolean enabled)
i) In this method, iterate over the alarms array and set each element to enabled.

it seems i just need invoke the method from the interface (setAlarmsEnabled)
for(int i = 0; i<alarm.length;i++)
alarm[i].setAlarmEnabled(enabled,"lontong");

this solution just in my mind after i posting my problem in this forum lol
sorry if this thread bothering you guys
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

andrey ag wrote:sorry if this thread bothering you guys


Not at all; in fact I'd say you've described the problem very well.

What you've written for your House constructor seems fine as far as it goes; the only thing you need to do is activate the "alarms".

If I told you that activating your Dog would probably look something like:
alarm[0].setAlarmEnabled(true, "down boy!");
does that help?
Now you just have to think how you might incorporate it into your class.

Also: In the classes that are "alarms", I see that you print out the required message; but I don't see anywhere where you've updated the alarmEnabled field, which is, presumably, what causes an alarm to go into action.

HIH

Winston
 
andrey ag
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

andrey ag wrote:sorry if this thread bothering you guys


Not at all; in fact I'd say you've described the problem very well.

What you've written for your House constructor seems fine as far as it goes; the only thing you need to do is activate the "alarms".

If I told you that activating your Dog would probably look something like:
alarm[0].setAlarmEnabled(true, "down boy!");
does that help?
Now you just have to think how you might incorporate it into your class.

Also: In the classes that are "alarms", I see that you print out the required message; but I don't see anywhere where you've updated the alarmEnabled field, which is, presumably, what causes an alarm to go into action.

HIH

Winston



yeah i already finish that exercises
here ismy final house class

and my houserunner


and i fix my setAlarmEnabled IF condition block, in Dog and SecuritySystem class


thankyou for your reply
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

andrey ag wrote:thankyou for your reply


You're most welcome.

However, I still don't see any place where you're actually activating the alarms in your House constructor.

You're almost there. In fact, I reckon one more line will do it.

Winston
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic