Write a class array that encapsulates an array

Assignment Help JAVA Programming
Reference no: EM1317340

2. Before we developed a StringLog ADT. It represents a "log" that holds objects of class String. Suppose that instead of restricting ourselves to strings, we decided to create a  "log" that holds objects of type Object. Describe the changes you would have to make to each of the following classes to implement such a change.

a. Change StringLogInterface to ObjectLogInterface

b. Change ArrayStringLog to ArrayObjectLog

c. Change ITDArrayStringLog to ITDArrayObjectLog

d. Change LLStringNode to LLObjectNode

e. Change LinkedStringLog to LinkedObjectLog

2. Write a class Array that encapsulates an array and provides bounds-checked access. The private instance variables should be int index and inarray[10]. The public members should be a default constructor and methods (signatures shown below) to provide read and write access to the array.

void insert(int location, int value);

void retrieve(int location);

If the location is within the correct range for the array, the insert method should set that location of the array to the value. Likewise, if the location is within the correct range for the array, the retrieve method should return the value at that location--the approach taken by the library before Java 5.0. In either case, if location is not within the correct range, the method should throw an exception of class ArrayOutOfBoundsException. Write an application that helps you test your implementation. Your application should assign values to the array by using the insert method, then use the retrieve method to read these values back from the array. It should also try calling both methods with illegal location values. Catch any exceptions thrown by placing the "illegal" calls in a try block with an appropriate catch. Share your code with classmates and compare and discuss the various implementations.

Reference no: EM1317340

Questions Cloud

Research and writing : Research and Writing: Brief Assignment,  Review the fact pattern provided below. At this time, Mr. Kant stands convicted of either petit larceny or shoplifting, as dictated by your state statutes,
Measure the distance pa, pb, pc : Measure the distance PA, PB, PC etc. from p to various point with chain or tape and plot them to scale along the co responding rays. Join the points a, b, c, etc. to give outline of survey.
Insert uml design diagrams, use case, classes : Insert UML design diagrams here (use case, class, and sequence diagram).
Create your own date class : You are to write a program that determines the day of the week for New Year's Day in the year 3000. To do this, you must create your own date class (MyDate) and use the following interface and main program:
Write a class array that encapsulates an array : Write a class Array that encapsulates an array and provides bounds-checked access. The private instance variables should be int index and inarray[10]. The public members should be a default constructor and methods (signatures shown below) to provide ..
Uml exercise : UML Exercise: Automated Teller Machine (ATM),   1. To allow authorized card holders to make transactions,   Brief Summary of Requirements:
What is economics system : What is economics system? What are the types of economics system? Briefly explain each type of economics system by giving examples of nations that are close to each type
A sewage treatment works stw : A sewage treatment works (STW) with 4 single-stage trickling filters has become organically overloaded due to the discharge of a biodegradable industrial effluent to the STW. This is causing effluent to pond on the surface of the filters.
Use an article that simply explains : use an article that simply  explains or describes  something (8 Steps to...; How to...; etc.). Find an article on this in a professional journal in your field and be sure that the author is making a case for something. Then:

Reviews

Write a Review

JAVA Programming Questions & Answers

  Evaluate the rtas resource requirements

Design and implement a set of classes and interfaces and use them to evaluate the RTA's resource requirements.

  Represent one book in java

Represent one book in java

  Create four classes

Create four classes: Account.java, Checking.java, Savings.java, and AccountArray.java.

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

  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 classes implement java interface

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

  Implementation of memory management

Implementation of memory management

  Implementation of encryption and steganography in java

This is a project report showing the essential details and coding structures related with the implementation of encryption techniques and steganography in JAVA.

  World data app

Prepare WorldDataApp project. It implements the NameIndex portion, including creating it in SetupProgram, and searching, viewing and updating it in UserApp program.

  Robot preparing for competition

Create an event so that the skateboard can be controlled by game player

  Communication with an smtp server

Develop a graphical user interface based java program that can communicate with a real SMTP email server for sending emails

  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!.

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