Question about java programming

Assignment Help Data Structure & Algorithms
Reference no: EM1380525

Question: Define a class named Document that have an instance variable of type String named text that stores any textual content for the file. Design 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: EM1380525

Questions Cloud

Repositioned by your employer to a new city : Zoning Change. You have been repositioned by your employer to a new city for an assignment that will probably last for two years. You don't want to sell your home
Illustrate what are some of primary goals of legislation : Illustrate what are some of primary goals of legislation. Name at least two ways this law revised bankruptcy proceedings. Do you think these changes are for better. Explain why or explain why not.
Emphasis on convenience for majority : If you would like to start a service business of recreation find one location where near Manhattan area do research on why you pick it. Keep in mind that emphasis on convenience for majority
Explain whether morrisons owe a duty of care to andrew : oneses sue Morrisons for their injuries. Explain whether Morrisons owe a duty of care to Andrew also Arvid.
Question about java programming : Define a class named Document that have an instance variable of type String named text that stores any textual content for the file. Design a technique named toString that returns the text field and also include a method to set this value.
A bank promotes home loans at low interest rates : A bank promotes home loans at low interest rates for its account holders for three months. Toward the end of the second month the bank withdraws the offer
Analyze political-social-ethical also legal differences : Analyze political, social, ethical also legal differences facing both organizations also determine impact se differences have on management decision making.
The robots will support the human pharmacists : Rondell Pharmacy is seeing switching to the use of robots to fill prescriptions that contain of oral solids or medications in pill form. The robots will support the human pharmacists and will reduce the number of human pharmacy workers needed
How you plan to revise also proofread your final paper : In case of a resume, a single error can put you out of competition. Question - Briefly illustrate conference explain how you plan to revise also proofread your final paper.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Explain the three types of relationships

Provide an example of a one to one relationship and an example of a many-to-many relationship in a newspaper, magazine, book, or everyday situation you encounter.

  Question about trigger

What are triggers used for, and why are they important in database systems? Give an example of a situation where a trigger would be appropriate.

  Illustrate insertion into the linear hash file

Illustrate insertion into the linear hash file. Suppose that bucket splitting occurs whenever file load factor exceeds (is greater than) 0.8.

  Create a program using c++

Create a program using C++ or Java that will automatically generate x numbers between a range provided by the user? For purposes of this project, the range can be 1-20 and store them in an array.

  Representation of the newick format

Create the graphical representation of Newick format tree given below. Label each leaf with appropriate sequence identifier, and label each branch with its appropriate length.

  Dbms and data mining to imporve customer service

Discuss how a database management system and data mining can help motor vehicle maintenance center improve its services, and what tables would be required in such a database.

  Create list of major steps to follow to get input

Create a list of major steps to follow to get input, process, and output desired information (software requirements). Refine the list to include individual refined steps (algorithm).

  Sharing a large computer file

Assume you are sitting at desk at office and using your laptop computer. The boss calls an emergency meeting for you and many colleagues, and asks everyone to bring his or her laptop computer.

  Finding median by black-box worst-case linear-time algorithm

Given a black-box worst-case linear-time algorithm for ?nding median, create algorithm solving the selection problem for an arbitrary order statistic.

  Question about database structure

Determine when a typical database is created the structure is constructed before the data is actually loaded into the database. What problems exist when someone wishes to add or delete from the existing structure?

  Clerical office placement setting

Determine what other databases would be known to benefit a clerical or job placement organization using databases?

  Creating the table showing decimal value

Assume if the last digit of a 2's complement binary number is 0, then number is even. If the last two digits of a 2's complement binary number are 00

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