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

  Add a process addtext to the question class

Add a method addText to the Question class, and give a different implementation of ChoiceQuestion that calls addText rather than storing an array list of choices.

  Define what use a read-only memory

define what use a read-only memory (ROM) serves in the design of a computer system. What type of information is kept in a ROM, and how does that information originally get into the memory?

  What are the feelings positive or negative

IT administrators in small companies must often execute several functions at the same time like network administrator, database administrator, user consultant and others. Compared to their situation, their colleagues in larger companies can get mo..

  Network cable planning

The company is very concerned with the network errors. State the advice you would provide regarding the design of the building and network cable planning which would help in order to decrease the network errors.

  Developing ways to support every applications

List some of the ways which we may guarantee that the majority of our target audience may play our applications.

  Time and space complexity

Express the following five loosely explained problems carefully in the form as used in the "Computers and Intractability".

  Show how to find out such a seating arrangement

Show how to find out such a seating arrangement and prove that no such seating plan is possible.

  Program to display a bouncing blue ball inside a jpanel

Write down a program to display a bouncing blue ball inside a JPanel. The ball should begin when the mouse is clicked inside the window. The ball will continue until the window is closed.

  Write down a public static method named chunk25

Write down a public static method named chunk25 that takes a double and returns an integer that represents the number of chunks of 25 in that number. A chunk of 25 is 25, or any part thereof

  Integrated services architecture

Explain how has the integrated services architecture is being provided a solution to growing variety and volume of traffic experienced within the Internet and Intranets? Describe in scholarly detail.

  Create the table relationships

make one query, your choice. Remember a query answers a question. As an example, list all household electronics that are greater in value than $200. Please ensure that the query title reflects what the query is about.

  Intrusion detection system or intrusion prevention system

Your company is deciding whether to employ the intrusion detection system (IDS), or an intrusion prevention system (IPS).

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