Define a class named teacher that is derived from person

Assignment Help JAVA Programming
Reference no: EM131942375

Assignment: OBJECT ORIENTED PROGRAMMING | JAVA

Task 1:

Step1: 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.

Step 2: 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 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.

Step 3: 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 fields.

Step 4: Create several sample objects of type Email and Filein themain method of your Tester class. 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 ;
}

Task 2:

Step 1: Define a class named Person that contains two instance variables of type String that stores the first name and last name of a person and appropriate accessor and mutator methods. Also create a method named displayDetails that outputs the details of a person.

Step 2: Define a class named Student that is derived from Person, the constructor for which should receive first name and last name from the class Student and also assigns values to student id, course, and teacher name. This class should redefine the displayDetails method to person details as well as details of a student. Include appropriate constructor(s).

Step 3: Define a class named Teacher that is derived from Person. This class should contain instance variables for the subject name and salary. Include appropriate constructor(s). Finally, redefine the displayDetails method to include all teacher information in the printout.

Step 4: Create a main method in your Tester class that creates at least two student objects and two teacher objects with different values and calls displayDetails for each.

Reference no: EM131942375

Questions Cloud

Why did organic valley need an enterprise system : 1. Why did Organic Valley need an enterprise system? 2. What factors contributed to the successful implementation and outcomes? Explain their importance.
What is the resulting annual discount rate : Compute the IRR of Projects A and B, and propose whether to accept or reject each project, assuming there are unlimited funds. Explain your decision.
Amendments on that particular company : Name a company that highlights the effect of one of the ten amendments on that particular company.
Research on cargills international business operations : Your proposals should take into account the unique characteristics of doing business internationally.
Define a class named teacher that is derived from person : Define a class named Teacher that is derived from Person. This class should contain instance variables for the subject name and salary.
Service management in the book : Read the book "be our guest: perfecting the art of customer service", and what is your reflection of the book?
What is the inventory turnover for this firm : Its cost of revenue (also known as: cost of goods sold/cost of sales) is $ 350,000 and its average inventory for the year is $30,000.
What causes increased incidence of intimate partner violence : What causes increased incidence of intimate partner violence in lesbian and gay partnerships
How does careful revision reflect the you attitude : Why should you limit the number of typefaces and type styles in most business documents?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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