Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Object Oriented Programming(Creating classes and variables)
Object Oriented Programming [message #766996] Fri, 16 December 2011 15:12 Go to next message
Sarah  is currently offline Sarah
Messages: 4
Registered: November 2011
Junior Member
I don't think this posted so I'm reposting...

So I'm still very new to Java and using Eclipse. I need help with something and I'm hoping someone can be of assistance. Here is what I am making:

An Animal class with a member variable called animalType that stores what kind of animal it is. There will also be a method called MakeSound() that returns a string that represents the sound the animal makes. Also need 4 classes derived from the Animal class that can make sounds. With this I'll also need another class named CallAnimal() that calls the MakeSound() method for each animal class and print out the animal sounds to a text file named AnimalSounds.txt

I understand how to create the class, but creating variables & methods in it is like reading German. Any help is greatly appreciated!! Thank you!!
Re: Object Oriented Programming [message #767014 is a reply to message #766996] Fri, 16 December 2011 16:12 Go to previous messageGo to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3136
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 16-Dec-11 13:13, Sarah wrote:
> I don't think this posted so I'm reposting...
>
> So I'm still very new to Java and using Eclipse. I need help with
> something and I'm hoping someone can be of assistance. Here is what I am
> making:
>
> An Animal class with a member variable called animalType that stores
> what kind of animal it is. There will also be a method called
> MakeSound() that returns a string that represents the sound the animal
> makes. Also need 4 classes derived from the Animal class that can make
> sounds. With this I'll also need another class named CallAnimal() that
> calls the MakeSound() method for each animal class and print out the
> animal sounds to a text file named AnimalSounds.txt
>
> I understand how to create the class, but creating variables & methods
> in it is like reading German. Any help is greatly appreciated!! Thank you!!

Sarah,

This question hasn't anything to do with Eclipse. It would be the same
in NetBeans and, indeed, in C# and Visual Studio, C++ and Eclipse, etc.

I would suggest the following to learn the Java language. (I don't get
"a cut" from saying this.)

1) Purchase and go through O'Reilly's Head First Java; use this as your
"grammar".

2) If you decided to get serious in Java, purchase Bruce Eckel's
Thinking in Java; use this as your "language reference".

3) Use Eclipse (or NetBeans) to do the programming examples. (I'm an
Eclipse guy, but to be fair, the other IDE is pretty dang good too,
especially for beginners.)

4) If you use Eclipse, come back here for help when you get stuck on
Eclipse problems. It won't be clear which problems are Eclipse and which
are Java at first, but we'll try hard not to bite your head off.

;-)

5) Use javaranch.com for asking Java questions.

Best of luck,

Russ
Re: Object Oriented Programming [message #767016 is a reply to message #767014] Fri, 16 December 2011 16:20 Go to previous message
Russell Bateman is currently offline Russell Bateman
Messages: 3136
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 16-Dec-11 14:12, Russell Bateman wrote:
> On 16-Dec-11 13:13, Sarah wrote:
>> I don't think this posted so I'm reposting...
>>
>> So I'm still very new to Java and using Eclipse. I need help with
>> something and I'm hoping someone can be of assistance. Here is what I am
>> making:
>>
>> An Animal class with a member variable called animalType that stores
>> what kind of animal it is. There will also be a method called
>> MakeSound() that returns a string that represents the sound the animal
>> makes. Also need 4 classes derived from the Animal class that can make
>> sounds. With this I'll also need another class named CallAnimal() that
>> calls the MakeSound() method for each animal class and print out the
>> animal sounds to a text file named AnimalSounds.txt
>>
>> I understand how to create the class, but creating variables & methods
>> in it is like reading German. Any help is greatly appreciated!! Thank
>> you!!
>
> Sarah,
>
> This question hasn't anything to do with Eclipse. It would be the same
> in NetBeans and, indeed, in C# and Visual Studio, C++ and Eclipse, etc.
>
> I would suggest the following to learn the Java language. (I don't get
> "a cut" from saying this.)
>
> 1) Purchase and go through O'Reilly's Head First Java; use this as your
> "grammar".
>
> 2) If you decided to get serious in Java, purchase Bruce Eckel's
> Thinking in Java; use this as your "language reference".
>
> 3) Use Eclipse (or NetBeans) to do the programming examples. (I'm an
> Eclipse guy, but to be fair, the other IDE is pretty dang good too,
> especially for beginners.)
>
> 4) If you use Eclipse, come back here for help when you get stuck on
> Eclipse problems. It won't be clear which problems are Eclipse and which
> are Java at first, but we'll try hard not to bite your head off.
>
> ;-)
>
> 5) Use javaranch.com for asking Java questions.
>
> Best of luck,
>
> Russ

I was asleep when I wrote this metaphor and got it backwards. Use Head
First Java as your language method and Thinking in Java as your
reference grammar.

Sorry,
Russ
Previous Topic:Special Characters not displayed in text editor
Next Topic:Object Oriented Programming with Eclipse
Goto Forum:
  


Current Time: Wed Jul 30 05:25:14 EDT 2014

Powered by FUDForum. Page generated in 0.01878 seconds