files,overload

P

pauli

hi , I would like to know how I can do the following issue:

If I have a class person , and I inherit from it a class called
student for example.
Now what shell I do if I want to enter the student's 4 grades then
read them later( using files),
than add these grades using overloading .
And finally sort the grades from the lowest to the highest , and get
the average.


thank u. & merry x-mas
 
N

Nicholas Hounsome

pauli said:
hi , I would like to know how I can do the following issue:

If I have a class person , and I inherit from it a class called
student for example.

Sounds like you have no idea about OO
Now what shell I do if I want to enter the student's 4 grades then
read them later( using files),
than add these grades using overloading .
And finally sort the grades from the lowest to the highest , and get
the average.

Sounds like you have no idea about OO and want someone who does to do your
homework for you
 
J

Jeffrey Schwab

osmium said:
pauli writes:




I would look into "cloud diagrams". There is a book, _Mastering
Object-Oriented Design in C++_ by Cay Horstmann which I think would be
useful. I suppose it is out of print, the book never seemed to catch on,
but your school library should have a copy unles the library is a complete
joke.

Do you think Usenet-aware teachers assign homework like this on purpose,
so posts from lazy students will be obvious?
 
O

osmium

pauli said:
If I have a class person , and I inherit from it a class called
student for example.
Now what shell I do if I want to enter the student's 4 grades then
read them later( using files),
than add these grades using overloading .
And finally sort the grades from the lowest to the highest , and get
the average.

I would look into "cloud diagrams". There is a book, _Mastering
Object-Oriented Design in C++_ by Cay Horstmann which I think would be
useful. I suppose it is out of print, the book never seemed to catch on,
but your school library should have a copy unles the library is a complete
joke.
 
G

Gene Wirchenko

On Wed, 24 Dec 2003 09:56:15 -0500, Jeffrey Schwab

[snip]
Do you think Usenet-aware teachers assign homework like this on purpose,
so posts from lazy students will be obvious?

No, lazy students are obvious because they want the whole thing
solved for them.

A student who is not lazy might post something like:

I am having trouble programming a binary search. My code below
works with the exception that it never finds the highest element.
When I adjust the initialisations, I can get it to work for the
highest element, but then it fails on other extremes. My text does
not cover this point, at least, not that I could follow. What am I
doing wrong, please?

Code:
Note how precise the request for help is.  BTW, I have had this
problem myself.  I still do not quite get it.

Sincerely,

Gene Wirchenko
 
O

osmium

Jeffrey said:
Do you think Usenet-aware teachers assign homework like this on purpose,
so posts from lazy students will be obvious?

No I don't. I thought it was a reasonable question, one that I could have
easily had myself a few years ago. I don't know why, but most everybody had
better instructors than I did in school. Or was I just dumb?

To the OP: The first decision you must make is if this is to be an STL
based program. The reason is the sort, lurking in the background; the STL
way will be a lot easier. You make your decision based on the book you have
been assigned, the reading assignments so far, and the instructors attitude
towards the STL. Does he think it is the greatest thing since canned beer?
If so, go with the STL, IOW you will have a *vector* (most likely) of
students, rather than an *array* of students.
 
J

Jeff Schwab

<op>
If I have a class person , and I inherit from it a class called
student for example.
Now what shell I do if I want to enter the student's 4 grades then
read them later( using files),
than add these grades using overloading .
And finally sort the grades from the lowest to the highest , and get
the average.
</op>
No I don't. I thought it was a reasonable question, one that I could have
easily had myself a few years ago. I don't know why, but most everybody had
better instructors than I did in school. Or was I just dumb?

Well, I don't think you're dumb, and I have a hard time believing your
programming instructors were worse than mine. I guess my issue with
this sort of post is that no attempt at code has been made, no "first
pass" to be fleshed out or improved. If someone really doesn't even
have any idea where to begin, I certainly don't mind trying to help, but
the OP on this thread seemed to have a pretty good idea of what steps
needed to be taken, and in what order.

Anyway, I suppose it was unnecessarily harsh to use the word "lazy;" my
apologies to Pauli.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,413
Latest member
KeiraLight

Latest Threads

Top