Define a class for file that is derived from document

Assignment Help C/C++ Programming
Reference no: EM13333460

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 filed and also include a method to set this value. Next, define a class for Email that is derived from Document and includes instance variables for the sender, recipient, and title of an email message. Implement appropriateaccessor and mutator methods. The body of the email message should be stored in the inherited variable text. Redefine thetoString method to concatenate all text field.

Similarly, define a class for File that is derived from Document and includes a instance 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 field.

Finally, create several sample objects of type Email and File in your main method. Test you 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 ContainKeyword (Document docObject, String keyword)
{
if (docObject.toString().indexOf(keyword, 0) >= 0)
return true;
return false;
}

 

Reference no: EM13333460

Questions Cloud

Aggravated assault with a motor vehicle : An assistant county attorney filed a complaint against a man charging him with aggravated assault with a motor vehicle.
Determine the acceleration of the hanging weight : A wheel rotates about a horizontal axis. It has an outer radius R1 = 18.8 cm and mass M1 = 5.12 kg. What is the acceleration of the hanging weight after it is released
Write an interactive program that prompts for a desired sum : Write an interactive program that prompts for a desired sum, then repeatedly rolls two six-sided dice until their sum is the desired sum. Here is the expected dialogue with the user.
Is it a violation of the canons of ethics for an attorney : Is it a violation of the Canons of Ethics for an attorney, who is engaged in the practice of criminal and civil law to be engaged in the business of making bail bonds under an assumed company name and to advertise such business in the telephone di..
Define a class for file that is derived from document : Similarly, define a class for File that is derived from Document and includes a instance 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 t..
Create a class called vehicle : Create a class called Vehicle that has the manufacturer's name (type String), number of cylinders in the engine (type int), and owner (type Person given below).
Determine the risk-free rate according to capm : the return on the market portfolio is currently 12%. mobile phone corporation stockholders require a rate of return of 30% and the stock has a beta of 3.2. according to capm, DETERMINE THE RISK-FREE RATE.
Calculate the new angular speed of the student : A student sits on a rotating stool holding two 3.6-kg objects. When his arms are extended horizontally, Find the new angular speed of the student
Define a class named creditcardpayment : Create a main method that creates at least two CashPayment and two CreditCardPayment objects with different values and calls payment Details for each.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Bare in mind this is a program

Bare in mind this is a program with the audience being lawncare and landscaping people. So the events will generally be to know how often a client wants their lawn mowed.

  Deal two cards at a time

Deal two cards at a time, print them out.- Check if they are identical, have just the same rank or just same suit or are completely.different. Print out a message indicating the result of your comparison.

  The user enter the total rainfall for each of 12 months

Write a program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display:the total rainfall for the year,the average monthly rainfall,and the months w..

  Users to input two forces by their components

write a programm to ask users to input two forces by their components of (Fx1,Fy1) and (Fx2,Fy2) from the keyboard.call twice the function to display both magnitude and direction angle of two forces on the screen.add two forces and display both magni..

  Function odd_fill() that fills all integers between two poin

write a function odd_fill() that fills all integers between two pointers, first and last, with a sequence of odd integers: 1,3,5,7

  Design, write, and test a program

Design, write, and test a program that represents some of the aspects of a student

  Create a program, using at least one for loop

Create a program, using at least one For loop, that displays the Sales Amounts made in each of 4 regions (North, South, East, and West) during a three month period.

  The initial data structure with information about a service

Implement a program using function for a defined task. Initial data is read from a file and added from keyboard. Program has to output initial and resulting data.The initial data structure with information about a service:

  Change this code to read in strings from a text file

code takes in a string from a user, checks if the paranthesis are ballanced (as defined by my class) and also returns the variable from my line (also from my class). All like to change this code to read in strings from a text file (each line is a str..

  Generate a two-dimensional array

Generate a two-dimensional array of integers of 10 rows by 10 columns that contains 100 random numbers between 0 and 9. Print out the array (well formatted) and do the following computations

  A program computes and displays the number of centimeter

The Earth's ocean levels have risen an average of 1.8 millimeters per year over the past century. Write a program computes and displays the number of centimeters and number of inches the oceans rose during this time.

  Write a program to crypt its input accordingly

Write a program to crypt its input according to a specified transformation scheme

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