This site requires JavaScript, please enable it in your browser!
Greenfoot back
2woodsway
2woodsway wrote ...

2011/11/18

Can Someone please help

2woodsway 2woodsway

2011/11/18

#
Assume that two classes 'Temperature' and 'Sensor' have been defined. 'Temperature' has a constructor that accepts a double parameter. 'Sensor' has a method named 'getReading' which returns the sensor's current reading (a double). Write a static method 'create' (that could be added to the 'Temperature' class) that accepts a 'Sensor' object. 'create' gets the value of the current reading of the 'Sensor' object, and returns a new 'Temperature' object that is based on this reading.
GameCode GameCode

2011/11/18

#
public static Temperature create( Sensor s )
{
    return new Temperature( s.getReading() );
}
2woodsway 2woodsway

2011/11/23

#
Thanks so much!!!
delmar delmar

2011/11/23

#
@2woodsway - Why don't you actually try to do your homework, instead of posting it here and getting someone else to do it for you? That's neither the point of this forum, nor making you any smarter.
darkmist255 darkmist255

2011/11/23

#
I hope that you tried it first, then posted is since you couldn't figure it out. I think Greenfoot should have something somewhere that tells people that if they are helping someone with homework, they should not just give them the answer. What's they saying? Give a man a fish, he eats for a day; teach a man to fish, he eats for life. Make sure they understand why you do what you tell them.
2woodsway 2woodsway

2011/11/27

#
@delmar, why don't you stop judging and assuming? Did it ever occur to you that this was the question to a test I failed in which I was looking for the correct asnwer so I could learn and understand where I went wrong? Did it ever occur to you that I was not just trying to get an answer for homework but was trying to understand where I went wrong? If you do not want to help I clearly understand. However, please refrain from your erroneous assumptions as this is insulting to someone who is utilizing every single resource to actually learn java. What's that saying? If you don't have anything good to say don't say anything at all?
delmar delmar

2011/11/27

#
Okay, so: Honestly, was that the question you failed on your test?
2woodsway 2woodsway

2011/11/27

#
Yes it was. Instead of just being okay with getting the question wrong, I wanted to learn where my error occured to strengthen my weakness. Not everyone is looking for a free handout on homework...just some guidance from our fellow collegues who have more experience. As opposed to getting ridiculed erroneously from those who forgot what it was like to struggle to understand something that seemed foreign to them.
mjrb4 mjrb4

2011/11/27

#
@2woodsway If you wanted help and understand where you went wrong, then surely the best thing to do is to post your attempt at the problem so we can tell you and explain to you exactly where you went wrong? Or nudge you in the right direction. Or would it hurt to explain some context behind why you're asking the question? If you're posting a question like the above without any explanation, your attempt, context etc. then at best it looks lazy, at worst it looks downright suspicious.
2woodsway 2woodsway

2011/11/27

#
Regardless of how it looks, it is always best to ask then to assume the worst.
delmar delmar

2011/11/28

#
> Yes it was. Yeah, right. Just like this person here who also, I am sure, just wanted to check his own test answer and, by mere chance, had the question text at hand to cut and paste, and also had no questions to ask about it. If you just want the answer to your homework, use Google.
darkmist255 darkmist255

2011/11/29

#
@2woodsway I agree that it's good of you to try to learn where you made your mistakes, that's great. I think that the question just was worded in a way that made it seem shifty, and a lot of people today (sadly) seem to just ask for answers. If you're trying to learn from your mistakes, just move forward knowing that these guys didn't know who you were and assumed that you were just being lazy. I have to agree with their initial thoughts, seeing just a question made it seem like a copy and paste thing. I'm sure they would've been very happy to answer if you started with something like "I tried -Code- for this question, but got the answer wrong. What did I do wrong?". Just some context that was left out that made things confusing :D. Good luck with your programming future!
You need to login to post a reply.