File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Exam question confusion - UML asks for print() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exam question confusion - UML asks for print() method" Watch "Exam question confusion - UML asks for print() method" New topic
Author

Exam question confusion - UML asks for print() method

Pedro Hall
Greenhorn

Joined: Jun 21, 2013
Posts: 2
I would really appreciate it if somebody could take a look at this. I've studying for an exam on Monday and am a little confused.

I'm working through previous exam papers and the first question always asks the student to write code based on a few UML diagrams.

Some of the classes usually contain methods for toString () and print ().

I can understand why the code should have a toString () method but I don't know what I'm supposed to do with the print() method..

See question 1 here for an example: http://exampapers.cit.ie/pastexams/Computing/KWEBD_8_Y1/2012%20Semester1/KWEBD_8_Y1%20SOFT7004%20Object%20Oriented%20Programming%201.pdf

Thanks.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38788
    
  23
Welcome to the Ranch

The answer is that whoever wrote those exam papers likes to have a print() method. I don't usually write them as a routine myself. Once you have a toString method you can probably write a print() method very simply like this:-I shall leave you to work out how that print() method works for yourself. It is really quite simple.
Pedro Hall
Greenhorn

Joined: Jun 21, 2013
Posts: 2
Thanks Campbell
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38788
    
  23
You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exam question confusion - UML asks for print() method