Help me on this ruby programm

Hi,

Write a program to create employee record with configurable number of
employes(5) and write the records to a text file
Emp ID:
Emp Name:
Emp Designation:
Emp DOB:
Please help me on above programm.

On 2011-04-18, at 22:54, srikanth madakam wrote:

Hi,

Write a program to create employee record with configurable number of
employes(5) and write the records to a text file
Emp ID:
Emp Name:
Emp Designation:
Emp DOB:
Please help me on above programm.

That sounds like an exercise in a programming course. I’m sure many of
us would be happy to help you, if you show us what you’ve done so far,
and ask us questions about what you don’t understand. On the other hand,
I don’t think any of us want just to write the program for you.

– vincent

Vincent M. wrote in post #993686:

On 2011-04-18, at 22:54, srikanth madakam wrote:

Hi,

Write a program to create employee record with configurable number of
employes(5) and write the records to a text file
Emp ID:
Emp Name:
Emp Designation:
Emp DOB:
Please help me on above programm.

That sounds like an exercise in a programming course. I’m sure many of
us would be happy to help you, if you show us what you’ve done so far,
and ask us questions about what you don’t understand. On the other hand,
I don’t think any of us want just to write the program for you.

– vincent

Hi,

i want to know, i want to create a class with above objects and pass the
same values via command line. help me on this.

On Tue, Apr 19, 2011 at 03:12:41PM +0900, srikanth madakam wrote:

Emp DOB:

i want to know, i want to create a class with above objects and pass the
same values via command line. help me on this.

With such a vague question, I’ll provide a somewhat vague answer:

Use the class keyword to create a class. Use an initialize method to
take input arguments for the data you need. Create an hash as an
instance variable to store the relevant data.

If you need to be able to make changes to data stored in your object’s
instance variables, you might want to look into the attr_accessor
method.

If you want more information than that, though, you’re going to have to
give us more to go on, and show us that you’re not just asking us to do
your homework for you (or get someone who doesn’t care about the
homework
to give you code, I suppose).

On 2011-04-18, at 23:12, srikanth madakam wrote:

Emp DOB:

i want to know, i want to create a class with above objects and pass the
same values via command line. help me on this.

What code have you written so far?

– vincent

would be better if you read the book
http://www.ruby-doc.org/docs/ProgrammingRuby/

On 2011-04-19, at 10:15, Chad P. wrote:

If you want more information than that, though, you’re going to have to
give us more to go on, and show us that you’re not just asking us to do
your homework for you (or get someone who doesn’t care about the homework
to give you code, I suppose).

Exactly. I wouldn’t want anyone to get the idea that we’re responding
negatively. Even if one of us had WANTED to do the OP’s homework, we
couldn’t. The original question was so vague as to be unanswerable. I
thought Chad’s answer was good, though when I read the original
question, I imagined one might need an array of 5 Employee instances.
But who could tell?

Speaking as someone who taught university/college/industry CS/SE for
going on 30 years, I enjoy helping people do their homework. I love
seeing people learn, and to the extent I can assist in that, I do. But
I’m not about to replace their effort with mine…that does neither of
us any good.

So, suppose you want help on your homework, or any other project? How do
you get me to help?

  1. If you can’t figure out where to get started, you might try There's an assignment at http://cs.somecollege.edu/cs101/asst2.pdf, and I haven't got a clue how to get started, can you suggest something?' (My answer to this: probably 3 or 4 questions that might help you figure out where to begin, such asAre there any people, places, or things in the
    problem that might turn into classes?’)

  2. If you have some code that doesn’t behave the way you expect it to,
    boil it down to the shortest piece of code you can, and then post it,
    along with `I expected it to do A, but it did B. Why?’

  3. If you can’t understand a class, method, or language feature, try
    `can you show an example of how to use Someclass#method_x properly?’

The more precise your question, the more useful the answers you’ll
receive.

– vincent

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs