The Artima Developer Community
Sponsored Link

Java Answers Forum
Help me create these classes

1 reply on 1 page. Most recent reply: May 31, 2004 6:06 AM by Prayag

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Brian

Posts: 1
Nickname: frosty
Registered: Apr, 2004

Help me create these classes Posted: Apr 22, 2004 12:22 PM
Reply to this message Reply
Advertisement
Create a class Newspaper. The method addArticle will recieve the desired article and return true if the page can be added, false if not. The information about each article is displayed in the ascending order by each positionNumber. and here is the UML diagram.


-------------------------------
Newspaper
-articles[]: Article
--------------------------------
+NewsPaper()
+NewsPaper(articles[]: Article)
+NewsPaper(articles[]: Article, name: String, numberOfPages: int)
+getArticle(index: int) : Article
+getArticles(): Articles[]
+setArticles(articles[]: Article): void
+addArticle(article: Article) : boolean
----------------------------------------


An added note given to us is...8.1.4 The addArticle method will work as the following: if there is at least one array index which is empty (in other words, if there is space for another article in the array), the method will add the article at the correct position, and return true. The correct position will be determined according to the positionNumber (the articles will be ordered in ascending positionNumbers). If all the array indexes contain an article, or one of the articles has the same positionNumber, then the method will not add the article, and return false



------------------------------------------------------------

The second class i need to create is Create a class Article. The properties and methods are shown in the UML Diagram which i put below...




-------------------------------------------
Article
--------------------------------------
-author: String
-columns: int
-positionNumber: int
------------------------------------------
+Article()
+Article(author: String, columns: int, positionNumber: int)
+getAuthor(author: String): String
+getColumns(): int
+getPositionNumber(): int
+setAuthor(author: String): void
+setColumns(columns: int): void
+setPositionNumber(positionNumber: int): void
----------------------------------------------------



anyone who can create these two classes. I'd most appreciate it thank you!


Prayag

Posts: 1
Nickname: munna22
Registered: May, 2004

Re: Help me create these classes Posted: May 31, 2004 6:06 AM
Reply to this message Reply
hi,
i saw your implementation and i think i ve got a similar homework as well ..... and i am new to java and UML...
could you please help me ...if possible give me a hint to do the class diagrams for the newspaper project ...
thks in advance

Flat View: This topic has 1 reply on 1 page
Topic: Beginner, Can someone Please help with this Code ? Previous Topic   Next Topic Topic: Writing Source code from other Web page on my jsp?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use