Java Forum / General / August 2007
How to call a class from another class
dlittlebear@gmail.com - 18 Aug 2007 14:50 GMT I do not know if I am saying that correctly. This is a school project, I do not know how to get data from 2 different files called Client.java and Attorney.java, both having data pulled in by LawFirm.java
The actual project is
CASE PROJECT
HOWARD, FINE, and HOWARD
The law firm of Howard, Fine, and Howard want to develop two classes -- a Client class that hows data about the firm's clients, and an Attorney class that hows data about each of the attorneys who works for the firm. Client data includes a client number, last name, first name, primary attorney's ID number, and balance owed to the firm. Attorney data includes an ID number, last name, first name, and annual salary. Each class includes public get and set instance methods for accessing the data. Create an application that instantiates five Clients and two Attorneys, assigns appropriate values to their data fields, and displays the values in an attractive format. Save the files as Client.java, Attorney.java and LawFirm.java.
Eric Sosman - 18 Aug 2007 15:02 GMT > I do not know if I am saying that correctly. This is a school > project, I do not know how to get data from 2 different files called [quoted text clipped - 18 lines] > fields, and displays the values in an attractive format. Save the > files as Client.java, Attorney.java and LawFirm.java. You've described the assignment, but not the difficulty you're having with it. What have you accomplished thus far, and what is your question about how to continue?
 Signature Eric Sosman esosman@ieee-dot-org.invalid
Andrew Thompson - 18 Aug 2007 16:16 GMT >> I do not know if I am saying that correctly. ... You do seem to be saying it 'too much'*. ....
>> fields, and displays the values in an attractive format. Save the >> files as Client.java, Attorney.java and LawFirm.java. > > You've described the assignment, but not the difficulty >you're having with it. What have you accomplished thus far, >and what is your question about how to continue? * The OP also multi-posted this question to c.l.j.help. Please do not multi-post in future. <http://www.physci.org/codes/javafaq.html#xpost>
Note that you already have something approaching a technical (start to an) answer on the other group, a group known for being very gentle towards people who are learning java (or new to usenet).
This group is better suited to techcical experts, and people who already understand how to ask 'smart questions'.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Lew - 18 Aug 2007 16:50 GMT > * The OP also multi-posted this question to c.l.j.help. > Please do not multi-post in future. [quoted text clipped - 8 lines] > people who already understand how to ask 'smart > questions'. Yeah, and I went and jumped in with an answer on that other thread, too.
Multiposting frustrates the people who are most likely to attempt to help. I remember another poster in these groups who adamantly refused to acknowledge a post made in another newsgroup on the same topic, asserting that if it was in a different group it was really in a separate thread and that he shouldn't have to be responsible for following the conversation across those different groups. I believe he took it to a snarky extreme, but it indicates how people can sometimes get over multiposting. (No, it wasn't Andrew.)
Anyway, I hope my response in the other group turns out useful for the OP.
 Signature Lew
Daniel Pitts - 19 Aug 2007 20:59 GMT > (No, it wasn't Andrew.) Sorry, but this made me literally LOL.
Lew - 19 Aug 2007 21:48 GMT >> (No, it wasn't Andrew.) > > Sorry, but this made me literally LOL. Actually I was a little sorry that I said it, as it's very unfair to Andrew.
Yes, Andrew is infamous for guiding people through the shoals of multiposting and SSCCEs, but he always does it in context of teaching the poster about these matters. He has never, and as far as I can tell, would never cop an attitude of "I shouldn't have to read it" about messages in other newsgroup(s), only that the OPs need to learn and correct.
OTOH, I knew that playing to his reputation about multiposting (and mine, too, natch) would carry humor, albeit at Andrew's expense.
Andrew, it's all in fun. I respect your work and your advice, as you know, and I am against multiposting also. Please accept my apology if in any way I offended you by doing this.
 Signature Lew
Andrew Thompson - 19 Aug 2007 23:16 GMT >>> (No, it wasn't Andrew.) >> >> Sorry, but this made me literally LOL. > >Actually I was a little sorry that I said it, as it's very unfair to Andrew. It's cool - it made me laugh as well. :-)
I know you well enough to understand that was meant in a purely instructive sense. Futher, people *might* have been wonderring.
Besides, don't forget I'm Aussie! You'd need an insult the size of Ayer's Rock (now known, again, as Uluru) to even get an Ocker to realise that they are *being* insulted.
Keep fighting the good fight, use my name as you see fit..
 Signature Andrew Thompson http://www.athompson.info/andrew/
Eric Sosman - 20 Aug 2007 00:03 GMT > [...] > Besides, don't forget I'm Aussie! [...] Is it true you really "are" an Aussie? Or do you just encapsulate an Aussie, or possibly implement one? (Jokes about "private members" and "extends" are strictly forbidden to avoid offending the innocent.)
 Signature Eric Sosman esosman@ieee-dot-org.invalid
Twisted - 20 Aug 2007 04:17 GMT > > [...] > > Besides, don't forget I'm Aussie! [...] [quoted text clipped - 3 lines] > (Jokes about "private members" and "extends" are strictly > forbidden to avoid offending the innocent.) Don't forget to use "protected"! It wouldn't do to catch a nasty virus, although you should still scan regularly with AVG just to be safe.
Also be sure to read the design pattern book when you get bored enough to need more elaborate arrangements. There's plenty of patterns -- even patterns involving three classes, and patterns involving more; three-class patterns where all three or only two pairs directly interface; and of course a good patterns book is fully illustrated with dozens of juicy UML diagrams of every possible contortion ...
Eventually you may also need to concern yourself with the inheritance hierarchy -- especially if you failed to use "protected" a time or two.
Andrew Thompson - 20 Aug 2007 07:40 GMT >> [...] >> Besides, don't forget I'm Aussie! [...] > > Is it true you really "are" an Aussie? Or do you >just encapsulate an Aussie, or possibly implement one? Actually, more a 'partial implementation'.
I implement Aussie.getSenseOfHumor() Aussie.extractUrine(); // an entirely different level of 'funny' to mere 'humor'
..but provide 'do nothing' methods for.. Aussie.betSenselessAmountsOfMoneyOnAnythingThatMoves() ..and.. Aussie.treatSportAsThoughItWereTHEMostImporantThingInExistence()
>(Jokes about "private members" and "extends" are strictly >forbidden to avoid offending the innocent.) Innocent? (looks around) Let /them/ use 'net nanny'.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|