Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use java 1 You are to implement an Editor class implementing the EditorInterface. In addition to the methods in the EditorInterface, implement a default constructor

use java

1 You are to implement an Editor class implementing the EditorInterface. In addition to the methods in the EditorInterface, implement a default constructor that initializes the editor with empty content.

The OutOfBoundsException should be an unchecked exception.

public interface EditorInterface { // inserts the ch at the location loc. // If the length of the document in the editor is smaller than loc, // raise an OutOfBoundsException void insert(int loc, char ch);

// removes the character at location loc. If the length of the document // is smaller than loc - 1, raise an OutOfBoundsException // returns the character at loc before the remove operation // the message for OutOfBoundsException is "OutOfBoundException: " + loc char remove(int loc);

// returns the content in the editor String getContent();

// returns the size of the document in the editor int size();

}

2

Implement a Logger class that has the following methods:

  • A default constructor creating an empty logger.
  • int put(String element): put the element into the logger and record its sequence number. The sequence number should stay the same for the entry.
  • List get(String element): retrieve the sequence numbers for each occurrence of the string in the logger. The sequence for this logger starts at 1.
  • int size(): number of entries in the logger.
  • int reset(): resets the logger, empties the entries and sets the start sequence to 1. Returns the number of entries before the reset.

Try to come up with an interface definition LoggerInterface for this class and then implements your interface.

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_2

Step: 3

blur-text-image_3

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

IBM Db2 11 1 Certification Guide Explore Techniques To Master Database Programming And Administration Tasks In IBM Db2

Authors: Mohankumar Saraswatipura ,Robert Collins

1st Edition

1788626915, 978-1788626910

More Books

Students also viewed these Databases questions

Question

Make effective use of recognition to motivate others.

Answered: 1 week ago

Question

State and explain 4 webs database

Answered: 1 week ago