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
What is the name of the technology that integrates vast data bases with georeferenced data in order to design, plan, and manage
ivanzaharov [21]

Answer:

"Geographic information systems " is the right answer.

Explanation:

  • This is indeed a computer-based method for observing and analyzing current events that are happening on the planet. GIS could enhance teaching and learning begin to understand geographical trends and regularities by relaying completely unconnected information.
  • It represent an experimental field and while the GIS supplier government offers us modern, improved, and quicker technical resources for the computer hardware.
7 0
2 years ago
How to connect on phpmyadmin?plss
Alex

Open your browser and go to localhost/PHPMyAdmin or click “Admin” in XAMPP UI. Now click Edit privileges and go to Change Admin password, type your password there and save it. Remember this password as it will be used to connect to your Database.

hope this helps!

5 0
2 years ago
What does AU stand for in computer?
SpyIntel [72]

Answer:

AU stands for <em>Audio Units.</em>

7 0
2 years ago
Investigators are combing the site of an explosion with mesh screens to collect evidence. The explosion was very large, leaving
rewona [7]

Answer: SCANNING ELECTRON MICROSCOPY,

Explanation:Many methods are available for use in an explosion site to determine or confirm the explosive materials or bomb fragment seen or obtained from the site they include the following; SCANNING ELECTRON MICROSCOPY,

CHROMATOGRAPHY-MASS SPECTROMETRY, STEREO MICROSCOPY, CAPILLARY ELECTROPHORESIS.

SCANNING ELECTRON MICROSCOPY, is a technique used to identify or confirm a material by scanning the surface of the material using FOCUSED BEAM OF ELECTRONS IN AN ELECTRON MICROSCOPE.

6 0
2 years ago
Read 2 more answers
Angela works for an identity protection company that maintains large amounts of sensitive customer information such as usernames
nata0808 [166]

Answer:the correct answer is the c)

An insider

Explanation:

Insiders that perform attacks have a distinct advantage over external attackers because they have authorized system access and also may be familiar with network architecture and system policies/procedures.

8 0
2 years ago
Other questions:
  • Is a protocol that allows users to log on to and access a remote computer?
    8·1 answer
  • The first graphical browser application for using the web was netscape. <br> a. True <br> b. False
    8·1 answer
  • Identify the six components of an information system. Which are most directly affected by the study of computer security? Which
    8·1 answer
  • When you receive a rejection message from an employer, you should?
    5·1 answer
  • O novo funcionário da equipe de desenvolvimento de sistemas está aprendendo os termos mais utilizados no dia a dia da empresa. A
    7·1 answer
  • Differentiate between trusted-source-security and antispoofing-security techniques.
    10·1 answer
  • Q. Which protocol would best serve to authorize users to access directory services?
    8·1 answer
  • Cloud computing allows organizations to rent computing resources from providers instead of having their own locally managed ____
    7·1 answer
  • Distinguished between
    9·1 answer
  • What are some of the most common obstacles in video games?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!