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...
-
An investor took a BUY position on KFC 85 put option for a premium of $ 3.5. Ignoring transaction costs, what is the breakeven price of this position? 1. If a call option on share has a strike price...
-
Structure what you think the problems are. Be sure to separate the problems from the symptoms. LO.1
-
Exhibit 4.21 presents selected operating data for three retailers for a recent year. Macys operates several department store chains selling consumer products such as brand-name clothing, china,...
-
The product will be sunglasses/ prescription glasses. Please complete the BOM and assembly chart.
-
FIGURE P23.44 shows a thin rod of length L with total charge Q. Find an expression for the electric field E at point P. Give your answer in component form. P FIGURE P23.44 + + + + + + + + +
-
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...
-
How many different bit strings can be transmitted if the string must begin with a 1 bit, must include three additional 1 bits (so that a total of four 1 bits is sent), must include a total of 12 0...
-
Maria A Solo (SSN 318-01-6921) lives at 190 Glenn drive, grand rapids, Michigan 49527-2005. Maria (age 45 and single) claims her aunt, Selda Ray (ssn 282-61-4011), as a dependent. Selda lives with...
-
A clinical trial was conducted to test the effectiveness of a drug used for treating insomnia in older subjects. After treatment with the drug, 11 subjects had a mean wake time of 95.1 min and a...
-
PROBLEM 13-3 Translation-Local Currency Is the Functional Currency LO7 (This problem is a continuation of the illustration presented in the chapter.) On January 2, 2019, P Company, a US-based...
-
The operations manager for a local bus company wants to decide whether he should purchase a small, medium, or large new bus for his company. He estimates that the annual profits (in $000) will vary...
-
Claim: Fewer than 8.2% of homes have only a landline telephone and no wireless phone. Sample data: A survey by the National Center for Health Statistics showed that among 13,215 homes 5.78% had...
-
Fill in the gaps in the following table: Symbol 59 3+ Protons 34 76 80 Neutrons 46 116 120 Electrons 36 78 Net charge 2+
-
If you want to solve a minimization problem by applying the geometric method to the dual problem, how many variables and problem constraints must be in the original problem?
-
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?
-
Discuss American History
-
Your firm has developed a new lithium ion battery polymer that could enhance the performance of lithion ion batteries. These batteries have applications in many markets including cellphones, laptops,...
-
Need help analyzing statistical data 1. ANOVA) True or false: If we assume a 95% confidence level, there is a significant difference in performance generally across all groups. 2. (t-test) True or...
Study smarter with the SolutionInn App