How to define a class named document

Assignment Help Computer Engineering
Reference no: EM1336458

Define a class named Document that contains an instance variable of type String named text that stores any textual content for the document. Create a method named toString that returns the text field and also include a method to set this value.

Next, define a class for Email that is derived from Document and includes member variables for the sender, recipient, and title of an email message. Implement appropriate accessor and mutator methods. The body of the email message should be stored in the inherited variable text. Redefine the toString method to concatenate all text fields.

Similarly, define a class for File that is derived from Document and includes a member variable for the pathname. The textual contents of the file should be stored in the inherited variable text. Redefine the toString method to concatenate all text fields.

Finally, create several sample objects of type Email and File in your main method. Test your objects by passing them to the following subroutine that returns true if the object contains the specified keyword in the text property.

public static boolean ContainsKeyword(Document docObject, String keyword)
{
if (docObject.toString().indexOf(keyword,0) >= 0)
return true;
return false;
}

Reference no: EM1336458

Expalin the file system that will be installed

define the file system that will be installed in the server of your local hospital to support remote access of information by the hospital's doctors while they are using the

Define a way to insert a row

How do I insert a row in multiple tables on different sheets in the similar workbook? I have 12 sheets, one for every month, and the sheets are exactly the same. Is there a w

Define what is internet storage

You would like to save the digital pictures you took on vacation onto your hard drive, but it would take up too much storage space. You have heard you can enhance your compu

Drawbacks of supporting links to files that cross mount

explain the advantages and disadvantages of supporting links to files that cross mount points (that is, the file link refers to a file that is stored in a different volume).

Write down a program that processes the test data

Write down a program that processes the test data. The output should be the Student's ID, followed by the answers, followed by the test score, followed by the test grade. As

You are sitting at the desk at work

You are sitting at the desk at work, using your laptop computer. The boss calls an emergency meeting for you and several coworkers, and asks everyone to bring his or her lap

The algorithms of the parallel and perspective projection

I have a java application that reads in a vertex list and face list. I also have code to write 2-D lines and ouput that image file. In my code I have the standard 3D default

How pert may be used for strategic decision making

Based on the article "One Application for Using PERT Methodology in Strategic Decisions," write down a memo to your CIO recommending how PERT may be used for strategic decis

Reviews

Write a Review

 
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd