Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A note-taking application has been written to allow people to record notes and search for given notes by keyword. Some code has already been written

A note-taking application has been written to allow people to record notes and search for given notes by keyword. Some code has already been written for this application, shown below.

public class Note

{

private String subject;

private String contents;

public Note (String topic, String words)

{

subject = topic;

contents = words;

}

/**

* search note for some words,

* return true or false

*/

public boolean includes (Sring text)

{

// to be completed

}

}

The class Note records subject and contents for a new text note. The includes method is incomplete.

a) Complete the body of the includes method. The method should return true if either the subject or the text of the note contains the text parameter.

A separate class, Journal, will maintain a list of Note objects together with the name of the person owning the journal. The class has been partially written, as follows:

import java.util.Arraylist;

public class Journal

{

private String name;

private Arraylist notes;

// constructor method to be completed

public int notesContaining (String text)

{

// count notes containing text

}

}

b) Write a constructor method for the Journal class. New Journal objects should have a name initialised using a parameter to the constructor method, and a empty list of notes.

c) Write a method, addNote, to add a note object to the notes ArrayList of a Journal object.

d) The notesContaining method will search all notes in the list for the given text and return a count of the number of notes which contain the text either in the subject or the contents. Complete the body of the notesContaining method.

Your help will be greatly appreciated. Massive thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions

Question

Complete the division. 36 2b-5)6b3 7b - 4b - 40 6b-15b 86

Answered: 1 week ago