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
  2. find the how much credits he has passed and his cumulative
    4.list the course where the student received a grade of f

On Mon, Nov 8, 2010 at 7:36 AM, Sayed mohammed Sayed jawad
[email protected] 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
  2. find the how much credits he has passed and his cumulative
    4.list the course where the student received a grade of f

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
[email protected] wrote:

  1. find the how much credits he has passed and his cumulative
    4.list the course where the student received a grade of f

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.


Phillip G.

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.

problem is how to output name start from name and end before new line

On Mon, 8 Nov 2010 07:20:53 -0500, Sayed mohammed Sayed jawad
[email protected] wrote in
[email protected]:

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.

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.

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.

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

Da: Intransition [mailto:[email protected]]
Inviato: venerd 11 novembre 2011 07:15
A: ruby-talk ML; [email protected]
Cc: ruby-talk ML; [email protected]
Oggetto: Re: important qution on ruby

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.

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

thank you very much