Define a class named document that contains an variable

Assignment Help Programming Languages
Reference no: EM13947915

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: EM13947915

Questions Cloud

What would you recommend doing : You're reluctant to stop hiring temps all together because you save about 8 percent in total labor costs. What would you recommend doing?
Which is describes how a master budget is used : Which is best describes a nonfinancial performance measure contained in most Balanced Scorecards? Which is describes how a master budget is used?
What is bestcares net working capital for 2011 : How does this balance sheet differ from the ones presented - What is Green Valley's net working capital for 2011 and What is BestCares net working capital for 2011
What is the purpose of a balanced scorecard : What is the purpose of a Balanced Scorecard? According to the Balanced Scorecard, what is a strategy? Explain the difference between lag measures and lead measures.
Define a class named document that contains an variable : 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.
Copy one file to another. : Source and destination files both exist. Script shall prompt for permission to overwrite the destination file. If permission is denied, program will display message and terminate.
Estimate the optimum moisture content : A silty clay soil has a plasticity index (PI) of 14. Estimate the optimum moisture content and the maximum dry unit weight of the soil when compacted using the procedure of:
Calculate the ultimate holding capacity of anchor : In Figure 14.40a, for the anchor slab in sand, H 5 1.52 m, h 5 0.91 m, B 5 1.22 m,S9 5 2.13 m, f9 5 308, and g 5 17.3 kN/m3. The anchor plates are made of con- crete and have a thickness of 76 mm. Using Ovesen and Stromann's method, calculate the u..
What is your definition of normal and definition of abnormal : What is your definition of Normal and your definition of Abnormal? How do we determine what is considered to be Abnormal Behavior

Reviews

Write a Review

Programming Languages Questions & Answers

  Create a new class called soda

Create a new class called Soda that is also a caffeinated beverage by default it will have no option for condiments. Have it called in main. Main also calls the old addLemon function on Tea so that the customer gets two lemons. Use an adapter to s..

  Create the program for iteration control structure

Iteration Control Structure create the program which models worm's behavior - Worm can enter apple when it is in body length of apple.

  Explaining exception handling using program

Use exception handling appropriately. Use comments to illustrate the various concepts applied / utilized in the solution.

  Write program uses while loop to output all odd numbers

Write a program that uses while loop to perform the following steps: Output all the odd numbers between firstnum and secondnum inclusive.

  Problematic programming situation

Suggest one example of a problematic programming situation or scenario that the use or implementation of a loop structure could resolve. Justify your response.

  Write program which computes amount of money earn

Write a program which computes amount of money person would earn over period of time if his or her salary is one penny the first day, two pennies the second day.

  Develop logic for program to read customer records

Develop the logic for a program that reads in 100 customer records and stores the first and last name and total purchases in three parallel arrays.

  Explain programming is designed to demonstrate the areas

This programming lab is designed to demonstrate the following areas of knowledge within C++, The difficult part is intended to be the decision-making required to both parse the file input and to correctly draw the resulting vector.

  Create test-methods for each operations

Write the methods to pass the tests. A significant portion of your score will be based on the effectiveness and thoroughness of your test-methods.

  Write a program to assign the integer values

Write a program to assign the integer values 1 through 25 to a 25-element integer array. Then, print the array as five separate lines, each containing five elements separated by commas

  Write a recursive-descent parser

Use any programming language you prefer to write a recursive-descent parser that parses the language generated by the following EBNF descriptions

  Design a class named customerrecord that holds a customer

design a class named customerrecord that holds a customer number name and address. include methods to set the values

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