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

  Distinguish between erp and scm software

Distinguish between ERP and SCM software. In what ways do they complement each other? Discuss the need for, and ways to integrate, these products with other types of enterprise systems.

  Display the miles per gallon obtained for each tankful

Display the miles per gallon obtained for each tankful

  Calculate is which step of planning a database

Which of the following is not one of the database objects present in the Access database window.

  Design a data structure which supports two operations

Design a data structure which supports two operations 1. Insert(S, x) inserts x into S. 2. Remove-Duplicates(S) removes from S all duplicated values.

  Make instances of each class

plan a Java class named Person with fields for holding a person's name, address and telephone number.

  Developing the flowchart using visual logic

Develop a flowchart by using the Visual Logic for a program which accepts a candy name.

  Four methods to provide data backup

What are the four methods used by the servers in order to provide the data backup, decrease the response time, and decrease the network and the server access time?

  How items in the array should be searched

Covers Sequential & Binary Search; Selection Sort, Bubble Sort, Index Sort, Merge Sort.How items in the array should be searched.

  Design a function method named gettimeparts

Declare the structure, and give it the name CurrentTime. The code in the function process should get the time of day and then store the current hour, minute, and second in the structure members.

  Program for dissimilar values for real numbers

Program for dissimilar values for real numbers

  How to create two arrays of integers

create two arrays of integers, each holding ten elements of data. Create a third array of integers for a result array. Your main program will take the two arrays of integers and pass them to the function subtract().

  Define the best possible scenario for an organization

If in a hypothetical situation your company was capable to hire only either technically sound managers with weak leadership skills OR strong leaders with less knowledge/interest in routine management, that would you opt for and why.

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