Test: Implement Test class with main method: Create an object of type WebsiteManager name it wm (serverName= www.mysite.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Test: Implement Test class with main method: Create an object of type WebsiteManager name it wm (serverName= www.mysite.

Post by answerhappygod »

Test Implement Test Class With Main Method Create An Object Of Type Websitemanager Name It Wm Servername Www Mysite 1
Test Implement Test Class With Main Method Create An Object Of Type Websitemanager Name It Wm Servername Www Mysite 1 (162.66 KiB) Viewed 13 times
Test Implement Test Class With Main Method Create An Object Of Type Websitemanager Name It Wm Servername Www Mysite 2
Test Implement Test Class With Main Method Create An Object Of Type Websitemanager Name It Wm Servername Www Mysite 2 (162.66 KiB) Viewed 13 times
Test Implement Test Class With Main Method Create An Object Of Type Websitemanager Name It Wm Servername Www Mysite 3
Test Implement Test Class With Main Method Create An Object Of Type Websitemanager Name It Wm Servername Www Mysite 3 (162.66 KiB) Viewed 13 times
Test Implement Test Class With Main Method Create An Object Of Type Websitemanager Name It Wm Servername Www Mysite 4
Test Implement Test Class With Main Method Create An Object Of Type Websitemanager Name It Wm Servername Www Mysite 4 (174.37 KiB) Viewed 13 times
Test Implement Test Class With Main Method Create An Object Of Type Websitemanager Name It Wm Servername Www Mysite 5
Test Implement Test Class With Main Method Create An Object Of Type Websitemanager Name It Wm Servername Www Mysite 5 (176.05 KiB) Viewed 13 times
Test: Implement Test class with main method: Create an object of type WebsiteManager name it wm (serverName= www.mysite.com number OfDocuments= 3). ● Create all the objects that shown in the following table and pass them as a parameter to method "add" of wm object: title Index size length 0.3 1200 0 document1.txt hdocument1.html 0.4 hdocument2.html 1.0 1500 Type of object Text Document HTML Documen HTMLDocument HTML Document Text Document Text Document 1 3000 2 2 hdocument3.html 1.0 4000 document2.txt 0.2 1300 document 3.txt 0.5 1600 4 3 ● Display all information of the documents of wm object by calling the method displa Print the number URLs of all downloadable documents and the sum of durations of downloadable (documents internetSpeed=2). Sample output: 4 3 java.lang.ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException: title: document1.txt size: 0.30MB length: 1200 words title: hdocument1.html size: 0.40MB length: 1500 words title: hdocument3.html size: 1.00MB length: 4000 words Web Manager Info: Number of URLS: 2 Total Durations: 2.209 BUILD SUCCESSFUL (total time: 0 seconds)

Test: Implement Test class with main method: Create an object of type WebsiteManager name it wm (serverName= www.mysite.com number OfDocuments= 3). ● Create all the objects that shown in the following table and pass them as a parameter to method "add" of wm object: title Index size length 0.3 1200 0 document1.txt hdocument1.html 0.4 hdocument2.html 1.0 1500 Type of object Text Document HTML Documen HTMLDocument HTML Document Text Document Text Document 1 3000 2 2 hdocument3.html 1.0 4000 document2.txt 0.2 1300 document 3.txt 0.5 1600 4 3 ● Display all information of the documents of wm object by calling the method displa Print the number URLs of all downloadable documents and the sum of durations of downloadable (documents internetSpeed=2). Sample output: 4 3 java.lang.ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException: title: document1.txt size: 0.30MB length: 1200 words title: hdocument1.html size: 0.40MB length: 1500 words title: hdocument3.html size: 1.00MB length: 4000 words Web Manager Info: Number of URLS: 2 Total Durations: 2.209 BUILD SUCCESSFUL (total time: 0 seconds)

Test: Implement Test class with main method: Create an object of type WebsiteManager name it wm (serverName= www.mysite.com number OfDocuments= 3). ● Create all the objects that shown in the following table and pass them as a parameter to method "add" of wm object: title Index size length 0.3 1200 0 document1.txt hdocument1.html 0.4 hdocument2.html 1.0 1500 Type of object Text Document HTML Documen HTMLDocument HTML Document Text Document Text Document 1 3000 2 2 hdocument3.html 1.0 4000 document2.txt 0.2 1300 document 3.txt 0.5 1600 4 3 ● Display all information of the documents of wm object by calling the method displa Print the number URLs of all downloadable documents and the sum of durations of downloadable (documents internetSpeed=2). Sample output: 4 3 java.lang.ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException: title: document1.txt size: 0.30MB length: 1200 words title: hdocument1.html size: 0.40MB length: 1500 words title: hdocument3.html size: 1.00MB length: 4000 words Web Manager Info: Number of URLS: 2 Total Durations: 2.209 BUILD SUCCESSFUL (total time: 0 seconds)

Writing Java Program (13 m depicted in the figure below, define one interface named Downloadable and five classes Jocument, TextDocument, HTMLDocument, WebsiteManager and Test. Class HTML Doc extends TextDocument and implements interface Downloadable. Subclass TextDocument extends superclass Document. The two classes have a "composition" relationship (WebsiteManager Array of Document). Class Test contains only main method. 662 Document # title: String #size: double + Document(title:String, size:double) + toString(): String «interface»> Downloadable TextDocument + duration (internetSpeed:int): double #length: int + TextDocument(title: String,size:double.length:int) + toString(): String HTMLDocument HTMLDocment(title:String,size:double,length:int) + duration (internetSpeed:int): double WebsiteManager - serverName: String - documents: Document[] + Website Manger(serverName:String. numberOfDocuments + add (document: Document, index:int):void +NumURLS(): int +totalDurations(internetSpeed:int):double +display()

s Description interface Downloadable: Document: ● ● duration(): takes an internet speed and returns the download duration title: title of this document size: size of this document Document(title:String, size:double): constructor to initialize the title and size with the received parameters. ● toString(): returns a string containing all information of the Document TextDocument: • length: length of text document ● TextDocument(title:String,size:double,length:int): constructor to initialize the title, size, and length with the received parameters. ● toString(): returns a string containing all information of the Text document. HTMLDocument: ● Create a final class called HTMLDocument which is a downloadable text document HTMLDocment(title:String,size:double,length:int): constructor to initialize the title, size, and length with the received parameters. duration (internetSpeed:int):double: return the calculated duration based on the following: the document size divided by the Internet speed, multiplied by length divided by 1000. Website Manager: serverName: name of servers documents: Array of type Document to store list of Document(TextDocument and HTMLDocument). WebsiteManager(String serverName, int numberOfDocuments): constructor to initialize the serverName and numberOfDocuments (size of thr array) with the received parameters. ● add (document: Document, index: int): a method which takes a document and an index, and puts the document at the specified index in the array. Use try-catch statement to handle the ArrayIndexOutOfBounds Exception which occurs when the index is out of range of an array and display an information of that exception. • NumURLS(): returns a number of URLs of all downloadable documents. totalDurations(internetSpeed:int): takes an Internet speed and returns the sum of durations of all downloadable documents. hint: use downcasting. display(): prints all information of documents by calling toString() method.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply