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

  Logic for a program that allows a user to enter 15 numbers

Design the logic for a program that allows a user to enter 15 numbers, then displays each number and its difference from the numeric average of the numbers entered

  Describe function work for array-based stack

Return number of items in stack. Describe how this function would work for array-based stack and what would change for pointer-based stack.

  Develop the payroll program to enter two double values

Develop the payroll program named CalcPay which permits the user to enter two double values namely hours worked and hourly rate.

  Write down a program that will randomly generate a number

write a program that will randomly generate a number from 1 to 100. the user will then guess the number via several

  Program to calculate state and county sales tax

Write a program that will ask the user to enter the amount of a purchase. The program should then calculate the state and county sales tax.

  Create program-ask user to enter amount of purchase

Create a program which will ask the user to enter the amount of a purchase. The program must then compute the state and county sales tax.

  Create a base class that contains all of the properties

Create a base class (also called a superclass) that contains all of the properties that are common to both of these products. Create 2 derived classes (also called subclasses) that contain different kinds of sizes.

  Develop a simple rentalcarcompany program for a rental car

Develop a simple RentalCarCompany program for a Rental Car Company, call it whatever you like. We will have two classes, a Car class and aRentalCarCompany class

  Machine language used by sim virtual computer simulator

Write a program in machine language used by the SIM virtual computer simulator package to calculate the sum of the four numbers stored in memory addresses A1, A2, A3 and A4.

  Using datagrid in an application

Update the field named fldQuestionDescription.

  Create the object-oriented design for dvd collection

Create the object-oriented design for system which keeps tracks of your CD and DVD collection. Recognize each of the classes, associated data, and operations for classes.

  Create application to generate a series of random numbers

Create the application to generate a series of 100 random numbers in the range of 1 through 1000. Save the series of numbers in a file.

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