Revise the class OneWayNoRepeatsList, as given in Listing 7.9, so that it allocates an extra element in
Question:
Revise the class OneWayNoRepeatsList, as given in Listing 7.9, so that it allocates an extra element in the array entry and ignores entry[0], as suggested earlier near the end of the section entitled “More About Array Indices.”
Listing 7.9
Transcribed Image Text:
/** 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 ()
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 50% (8 reviews)
ANSWER An object of this class is a special kind of list of strings You can write the list only from ...View the full answer
Answered By
Churchil Mino
I have been a tutor for 2 years and have experience working with students of all ages and abilities. I am comfortable working with students one-on-one or in small groups, and am able to adapt my teaching style to meet the needs of each individual. I am patient and supportive, and my goal is to help my students succeed.
I have a strong background in math and science, and have tutored students in these subjects at all levels, from elementary school to college. I have also helped students prepare for standardized tests such as the SAT and ACT. In addition to academic tutoring, I have also worked as a swim coach and a camp counselor, and have experience working with children with special needs.
0.00
0 Reviews
10+ Question Solved
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Question Posted:
Students also viewed these Computer science questions
-
Add a method insertionSort to the class ArraySorter, as given in Listing 7.10, that performs an insertion sort of an array. To simplify this project, our insertion sort algorithm will use an...
-
Add a method bubbleSort to the class ArraySorter, as given in Listing 7.10, that performs a bubble sort of an array. The bubble sort algorithm examines all adjacent pairs of elements in the array...
-
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...
-
M1 is a way to measure... a) the level of bank reserves b) a country's money supply c) the level of savings in a country d) a country's economic potential
-
Repeat Prob. 9-50 when the state of the air at the beginning of the compression is 80 kPa and 220oC. Prob. 9-50 An air-standard dual cycle has a compression ratio of 14 and a cutoff ratio of 1.2. The...
-
4. Consider the two-player game with players, strategies and payoffs described in the following game matrix. L Player B M R t 0,3 6,2 1,1 Player A m 2.3 0,1 7,0 b 5.3 4,2 3, 1 Figure 6.28: Payoff...
-
List the advantages of using PLCs in safety applications, as compared to relays.
-
Algonquin Carpets reported the following amounts in its 2013 financial statements. The 2012 figures are given for comparison. Requirements 1. Calculate Algonquins acid-test ratio for 2013. Determine...
-
You have just completed the appraisal of an office building and have concluded that the market value of the property is $3,500,000. You expect Potential Gross Income (PGI) in the first year of...
-
SUPPLY CHAIN MANAGEMENT W.W. Grainger and McMaster-Carr: MRO Suppliers W.W. Grainger and McMaster-Carr sell maintenance, repair, and operations (MRO) products. Both companies have catalogs and web...
-
Practice Program 2 used two arrays to implement a simple phone book. A more scalable solution is to make an array of an object that stores the name and corresponding phone number. Modify the program...
-
Practice Program 5.4 asked you to define a Trivia class that contained strings representing a trivia question and answer to that question. Add an integer for the number of points that the question is...
-
Which object oriented diagrams are generated during inception phase?
-
From the following information determine the total 2019 tax due for Charlene and Dick Storm, assuming they file a joint return, have three dependents, and are not members of a qualified retirement...
-
For a balanced three-phase positive-sequence currents \(I_{a}, I_{b}, I_{c}\), does the equation \(I_{a}+I_{b}+I_{c}=0\) hold good?
-
The internal inductance \(L_{\text {int }}\) per unit-length of a solid cylindrical conductor is a constant, given by \(\frac{1}{2} \times 10^{-7} \mathrm{H} / \mathrm{m}\) in SI system of units. (a)...
-
Considering two parallel three-phase circuits that are close together, when calculating the equivalent series-impedance and shunt-admittance matrices, mutual inductive and capacitive couplings...
-
To control corona, transmission lines are usually designed to maintain the calculated conductor surface electric field strength below \(\mathrm{kV}_{\mathrm{rms}} / \mathrm{cm}\).
-
A square is 3.5 m on a side, and point A is the midpoint of one of the sides. On the side opposite this spot, two in-phase loudspeakers are located at adjacent corners, as shown in the figure....
-
Create an appropriate display of the navel data collected in Exercise 25 of Section 3.1. Discuss any special properties of this distribution. Exercise 25 The navel ratio is defined to be a persons...
-
Describe an example of a text T of length n and a pattern P of length m such that the brute-force pattern-matching algorithm achieves a running time that is (nm).
-
In Figure 13.14, we illustrate that GTTTAA is a longest common subsequence for the given strings X and Y. However, that answer is not unique. Give another common subsequence of X and Y having length...
-
What is the longest (proper) prefix of the string "cgtacgttcgtacg" that is also a suffix of this string?
-
Find the first derivative of the following equation: a. b. y=e3x y=e(x+1) d. y=125x+16-2x y=ln x y=ln (3x+x1) y=In (x+1)
-
The Cutting Department of Lasso Company has the following production and cost data for August. Production Costs 1. Started and completed 9,600 units. Beginning work in process $0 2. Started 2,300...
-
There is sufficient evidence to support the conclusion that a robust relationship exists between drugs and crime. Explain and discuss the studies that support this conclusion. Further explain and...
Study smarter with the SolutionInn App