1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
svetlana [45]
3 years ago
12

Reimplement StringSet with the exception that it should now extend ArrayList instead of encapsulating a String[]. You can easily

abolish the 10 String limit for this new StringSet. You can also remove the int instance variable, as your class will no longer need it. Your existing StringSetTester should work with the new StringSet without being changed. Hint: What type of elements did the original StringSet store? What type of elements will be inserted into our ArrayList superclass? How can we tell Java that our ArrayList will be storing that type of element?
Computers and Technology
1 answer:
kolbaska11 [484]3 years ago
4 0

Answer:

Here is the program for the given question

Explanation:

class StringSet

{

ArrayList<String> arraylist; //a reference variable of ArrayList of generic type String

//A no argument constructor.

public StringSet()

{

arraylist=new ArrayList<String>(); //instantiating the ArrayList object

}

//A mutator that adds a String newStr to the StringSet object.

void add(String newStr)

{

arraylist.add(newStr); // add(String) method to add string to the arraylist

}

//An accessor that returns the number of String objects that have been added to this StringSet object.

int size()

{

return arraylist.size(); // size() method which gives the number of elements in the list

}

//An accessor that returns the total number of characters in all of the Strings that have been added to this StringSet object.

int numChars()

{

int sum = 0;

for(String str:arraylist) //for-each loop; can be read as for each string in arraylist

{

sum+=str.length();

}

 

return sum;

}

//An accessor that returns the number of Strings in the StringSet object that have exactly len characters.

int countStrings(int len)

{

int count = 0;

for(String str:arraylist)

{

if(str.length() == len)

count++;

}

return count;

}

}

You might be interested in
PLZ ANSWER IT..<br>IT IS VERY URGENT....​
PSYCHO15rus [73]

a) Cut/copy and paste allows you to select a section of text and insert a new copy of that text. You can also transfer data from one place to another.

b) Save is when you keep your work for later and it will be the same as you left it. Think of it like putting a bookmark in your book. Save as lets you name the files.

c) Close and Exit just let you leave the program, saying you are finished working with it and want to do something else.

7 0
2 years ago
Given that ∠XQR = 180° and ∠LQM = 180°, which equation could be used to solve problems involving the relationships between ∠XQM
mr Goodwill [35]

C) 180 − (140 − 7a) = (70 − 3a)

Answer:

C) 180 − (140 − 7a) = (70 − 3a)

Explanation:

i got it wrong by clicking D on usatestprep

4 0
3 years ago
A system forensics specialist has three basic tasks related to handling evidence: find evidence, preserve evidence, and ________
dmitriy555 [2]

Answer:

It would be Store

Explanation:

hope this helps if not sorry :(

3 0
2 years ago
(iii) ............ characters can be stored in memo field. (a) 50 (b) 64000 (c) 255 (d) 200 ​
Svetlanka [38]

Answer:

(b) 64000

Explanation:

Assuming that the "Memo" being mentioned is a Microsoft Access memo field, it can hold up to 64,000 characters, even in the more recent version of the application where the "Memo" is now know as the "Long Text" field.

According to microsoft.com, "In earlier versions of Access, we used the Memo data type to store large amounts of text... the Long Text field works the same as the Memo field of old... [it] can only display the first 64,000 characters."

<em>Please put "Brainliest" on my answer if it helped you out the most!</em>

<em>(Further Reading) If you're still confused, I suggest you search up the following:</em>

<em>- Microsoft Access Long Text character limit</em>

7 0
2 years ago
Need some help thanks
sergeinik [125]

Answer:

1. There are many ways to write an algorithm. Some are very informal, some are quite formal and mathematical in nature, and some are quite graphical. The instructions for connecting a DVD player to a television are an algorithm. A mathematical formula such as πR2 is a special case of an algorithm. The form is not particularly important as long as it provides a good way to describe and check the logic of the plan.  The development of an algorithm, a plan is a key step in solving a problem. Once we have an algorithm, we can translate it into a computer program in some programming language. Our algorithm development process consists of five major steps.

2. computers only do what you told them to do, so If you wrote something wrong or you wasn't precise enough it might cause a massive damage and cause you to lose a lot of money.

3. You know when a problem should be solved whenever you need to make a decision that is important, or requires human intelligence and a computer doesn’t have human intelligence.

4. The process does sound familiar to me; it is like the mechanism of operation of the computer. Through reflex actions, our bodies take in input and respond sometimes without our control, such as shivering, blinking, and sneezing.

5. The brain uses chemicals to transmit information; the computer uses electricity. Even though electrical signals travel at high speeds in the nervous system, they travel even faster through the wires in a computer. Both transmit information. A computer uses switches that are either on or off ("binary").

5 0
2 years ago
Read 2 more answers
Other questions:
  • What is the primary purpose for a screen saver in windows?
    8·1 answer
  • Which view is used to allow a publisher to view facing pages of a publication at the same time? Normal Master Page Two-Page Spre
    5·1 answer
  • _____ _____ deals with the definitions properties of mathematical models of computation.
    8·1 answer
  • what are the benefits of VolP? select all that apply. A:cheaper printings B:clearer calls C: faster download D: increased effici
    11·2 answers
  • From space, the world looks very different. Describe what these surfaces look like from an airplane’s view:
    13·2 answers
  • The most commnonly used OS is ___.<br> MS-DOS<br> Windows<br> Mac<br> Linux
    8·1 answer
  • Explain how to utilize the computer in rooms management.​
    13·1 answer
  • 3. In 1989, the first handheld console was released by _____ and it was called ________.
    13·1 answer
  • Should a UDP packet header contain both Sour Port # and Destination Port #?
    7·1 answer
  • Amber, a network administrator, is conducting VoIP training for other IT team members. Melanie, a new team member, is confused a
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!