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

Questions Cloud

Factors affecting effective incentive plan : Whether the plan should be based on group or individual employee performance and The level of risk employees will be willing to accept in their overall compensation package
Explain how has the internet changed the tactics : Explain How has the Internet changed the tactics and How has the Internet changed the tactics organizations use in their marketing mix
Write down the largest and the smallest numbers to screen : Write down a Java program that will search a text file of strings representing numbers of type int and will write the largest and the smallest numbers to the screen.
Explain about marketing : Explain about Marketing and Discuss the dimensions for segmenting markets and Provide a succinct overview of the key components of a marketing plan
How to define a class named document : express 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.
Show the important hr skills for supervisors : Important HR Skills for Supervisors - Demonstrating Communication Skills and Determining Effective Orientation and Training Methods
Management of human resources : What do you think about the way executive compensation has escalated over the last several years and Do you think it is justifiable? Why or why not?
Design a script that will allow the user to enter one : make a script that will allow the user to enter one of several choices from the command line.
Explain consumer behavior principles : Explain Consumer behavior principles and Explain the roles of learning and memory theories in developing marketing strategies

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write down a simple near procedure

Write down a simple near procedure (such as a return) and call it using register addressing.

  Make the get/set methods for each of your variables

select a product that lends itself to an inventory (for example, products at your workplace, office supplies, music CDs, DVD movies, or software).

  Explain the method to create a scheme for vb mail order

Explain the method to create a scheme for VB Mail Order

  Produce a book class that stores book information

Produce a Book class that stores book information

  What is the des

What are the substitution ciphers? How do they differ from one-time pads (OTP)? Which is better for the IS manager to employ and why.

  Displaying recent entries of windows security event log

Issue a command which will show 100 most recent entries within the Windows security event log displaying only those entries which were a successful logon event by the Interactive logon.

  Altering the dijkstra’s algorithm

Alter Dijkstra’s algorithm in order to compute the shortest paths from the source vertex s in O(W·|V|+|E|) time.

  Describe why software objects more "reusable"

define why software objects more "reusable" than other types of computer code.

  Structured error handling in appropriate places in program

Add a form that includes the RichTextBox control and several predefined template letters. This part of the program would be used to write letters to your customers when there is a specific issue you will like to address with them, so use your imag..

  How to maintain inventory data on resources stored

give an eLibrary system where patrons can search a database to retrieve either the location of an actual resource in the library or an electronic copy of the source.

  Sum of array elements

Provided an array of ints named x and an int variable named total which has already been described, write down some code which places sum of all the elements of the array x into total.

  Supporting day-to-day working activities of organization

In order to support the day-to-day working activities of organization. Typical decisions include e-commerce transaction acceptance.

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