Important qution on ruby

hi
I have problem with ruby and i need help from you:
Q.
write ruby script that will read a student transcript which was saved as
text file and retrieve the following information:

1. find the major gpa (for itcs or itce)
2.find the id number and name of student
3. find the how much credits he has passed and his cumulative
4.list the course where the student received a grade of f

Attachments:
http://www.ruby-forum.com/attachment/5316/1.txt

···

--
Posted via http://www.ruby-forum.com/.

And what is your "problem with Ruby"? You sure do not expect us to do
your homework for you, do you?

robert

···

On Mon, Nov 8, 2010 at 7:36 AM, Sayed mohammed Sayed jawad <s.mjm22@hotmail.com> wrote:

I have problem with ruby and i need help from you:
Q.
write ruby script that will read a student transcript which was saved as
text file and retrieve the following information:

1. find the major gpa (for itcs or itce)
2.find the id number and name of student
3. find the how much credits he has passed and his cumulative
4.list the course where the student received a grade of f

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

We certainly can help you with debugging your code, but writing a
script from scratch is a bit much to ask. :slight_smile:

If you need a starting point, investigate the File, Array, Hash and
String classes.

Note: It's a bad idea to post personal information (like a student's
name and ID number) on the internet.

···

On Mon, Nov 8, 2010 at 7:36 AM, Sayed mohammed Sayed jawad <s.mjm22@hotmail.com> wrote:

hi
I have problem with ruby and i need help from you:
Q.
write ruby script that will read a student transcript which was saved as
text file and retrieve the following information:

1. find the major gpa (for itcs or itce)
2.find the id number and name of student
3. find the how much credits he has passed and his cumulative
4.list the course where the student received a grade of f

--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

hi
i need code by ruby regular expression and i am new to this language so
i need to solve this problem to know what happen exactly.
note: the information is not real.

···

--
Posted via http://www.ruby-forum.com/.

ok
after all this day i want full code of the problem. if any one still say
it's homework!!!!!!!!!!!!!!!!!!!!!!

···

--
Posted via http://www.ruby-forum.com/.

Break the problem down. What is given? First a file. So you need to "read"
the "File". Look up `File.read` and read about that.

Okay if you have done that, let's say you have read the file into a
variable called `text`.

Now you need to extract information from that text. How will you do this?
There a basically two ways: by position or by pattern. So you need to
figure out what about the file is always the same no matter which students
record it is and use that as a guide to locate the other information.

For example the number appears like so:

    *Number :* 20085252

You could get this information by matching against the *Number :* part so
as to find the rest. So something like

      match = /\*Number\s*:\*(\d+)/.match(text)

The characters in between the /.../ are a Regular Expression. Look that up
and read about them. Notice we had to use `\` in some places to "escape"
characters or to indicate a special type of character, e.g. \d means any
digit.

Because of the (\d+) we have capture the digits in the first match element,
so:

      number = match[1]

Now you should be able to read up on the things I suggested and work out
how to do it for the rest of the information.

And have fun. It's a like a puzzle, not a chore.

On Mon, 8 Nov 2010 07:20:53 -0500, Sayed mohammed Sayed jawad
<s.mjm22@hotmail.com> wrote in
<48eb56bc49bafc513b59ae2619d957c7@ruby-forum.com>:

i need code by ruby regular expression and i am new to this language so
i need to solve this problem to know what happen exactly.
note: the information is not real.

You still haven't asked a question, you just told us that you need to
write a script. Go ahead and write one. If you run into questions
doing so, ask them.

···

--
Charles Calvert | Software Design/Development
Celtic Wolf, Inc. | Project Management
http://www.celticwolf.com/ | Technical Writing
(703) 580-0210 | Research

Break the problem down. What is given? First a file. So you need to "read"
the "File". Look up `File.read` and read about that.

Okay if you have done that, let's say you have read the file into a variable
called `text`.

Now you need to extract information from that text. How will you do this?
There a basically two ways: by position or by pattern. So you need to figure
out what about the file is always the same no matter which students record
it is and use that as a guide to locate the other information.

For example the number appears like so:
    *Number :* 20085252

You could get this information by matching against the *Number :* part so as
to find the rest. So something like

      match = /\*Number\s*:\*(\d+)/.match(text)

The characters in between the /.../ are a Regular Expression. Look that up
and read about them. Notice we had to use `\` in some places to "escape"
characters or to indicate a special type of character, e.g. \d means any
digit.

Because of the (\d+) we have capture the digits in the first match element,
so:

      number = match[1]

Now you should be able to read up on the things I suggested and work out how
to do it for the rest of the information.

And have fun. It's a like a puzzle, not a chore.

···

Da: Intransition [mailto:transfire@gmail.com]
Inviato: venerdì 11 novembre 2011 07:15
A: ruby-talk ML; ruby-talk-google@googlegroups.com
Cc: ruby-talk ML; ruby-talk@ruby-lang.org
Oggetto: Re: important qution on ruby

--
Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f

Sponsor:
ING DIRECT Conto Arancio. 4,20% per 12 mesi, zero spese, aprilo in due minuti!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=11921&d=29-12