Question: Write a method beyondLastEntry(position) for the class OneWayNo-RepeatsList, as given in Listing 7.9, that returns true when position is beyond the last entry on the

Write a method beyondLastEntry(position) for the class OneWayNo-RepeatsList, as given in Listing 7.9, that returns true when position is beyond the last entry on the list.


Listing 7.9

/** An object of this class is a special kind of list of strings. You can write the list only from beginning to end. You can add only to the end of the list. You cannot change individual entries, but you can erase the entire list and start over. No

/** An object of this class is a special kind of listof strings. You can write the list only from beginning to end.

/** An object of this class is a special kind of list of strings. You can write the list only from beginning to end. You can add only to the end of the list. You cannot change individual entries, but you can erase the entire list and start over. No entry may appear more than once on the list. You can use int variables as position markers into the list. Position markers are similar to array indices, but are numbered starting with 1. * / public class OneWayNoRepeatsList public static int START POSITION = 1; public static int DEFAULT SIZE = 50; //entry.length is the total number of items you have room //for on the list (its capacity); countofEntries is the number of //items currently on the list. private int countofEntries; //can be less than entry.length. private String[] entry; /** Creates an empty list with a given capacity. */ public OnewayNoRepeatsList (int maximumNumberofEntries) entry = new String [maximumNumberofEntries]; countofEntries = 0; /** Creates an empty list with a capacity of DEFAULT SIZE. */ public OneWayNoRepeatsList () entry = new String [DEFAULT SIZE]; = 0; countofEntries // or replace these two statements with this (DEFAULT SIZE); public boolean isFull ()

Step by Step Solution

3.35 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

ANSWER public boolean beyondLastEntry int position return p... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java An Introduction to Problem Solving and Progra Questions!