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

  Determine schedule that obtains maximum amount of profit

Assume you have one machine and a set of n jobs a1, a2, ..., an to process on that machine. Determine the schedule that obtains the maximum amount of profit. Compute the running time of your algorithm?

  Writing a c program

Create a C program that has a declaration in main() to store the following numbers into an array named channels: 2, 4, 5, 7, 9, 11, 13. There should be a function call to display().

  Creating relational database about music performers

Create a relational database having information about music performers, their recordings, and the composers of the music they recorded.

  Computing minimal length of key-average cracking time given

If Encrypt-It-Rite would like to increase average cracking time to at least 100 years, determine the minimal length of the key?

  Algorithm to decide flavor of ice cream

A group of ten people need to decide which one flavor of ice cream they will all order, out of three options. The algorithm can question and re-question the participants, and present the answers to the participants.

  Question about data model

Create a simple data model that outlines a database management system. This model requires to track people's participation in several fitness activities at a fitness center.

  Analyze the time-space complexity of algorithms

How a vEB tree can be used to support these three operations and analyze the time/space complexity of your algorithms.

  Creating a data flow chart

Create a Data Flow Chart and then make an application that allows a user to enter a stock transaction and determine the stockbroker's commission.

  Show result of inserting keys using linear probing

Show the result of inserting these keys using linear probing, using quadratic probing with c1 = 1 and c2 = 3, and using double hashing with h2(k) = 1 + (k mod (m ¡ 1)).

  Create an asp.net project with visual studio

Design an ASP.NET assignment with Visual Studio that contains two aspx forms. The 1st form uses the Login control to a login page. Users should not be able to view second form unless they have entered a correct username and password.

  Generalize 2-3 algorithms for insert and delete

Generalize the 2-3 algorithms for INSERT and DELETE to K-J trees, where non-leaf vertices have between K and J children for fixed integers K >=2, and J>= 2K-1.

  Describe algorithm that finds maximum feasible flow in graph

Describe an algorithm that finds a maximum feasible flow in G. Denote by MF(|V|, |E|) the worst-case running time of an ordinary maximum flow algorithm.

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