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
ELEN [110]
3 years ago
13

Exploring Arraylists. Remember that arraylists are good for adding and removing things, and that they are clock-cycle friendlier

in this case than resizing arrays as we discussed in lecture. This lab allows you to get some hands-on using an arraylist so you will remember it for those times it would be a good fit for an application. a) Create an Arraylist of type String and prompt the user for three names and add these names to your ArrayList. b) Print a message with the number of elements in the ArrayList for the user using the size() method (to find the number to print.) c) Prompt the user for two more names and add them to the ArrayList and once again print a message with the number of elements in the ArrayList for the user. d) Use a loop to print all of the names in the ArrayList for the user. e. Ask the user for a name to remove, remove the value the user provides, and then use a loop to print all of the names in the ArrayList for the user. (25 points)
Computers and Technology
1 answer:
Yuliya22 [10]3 years ago
5 0

Answer:

Code is given below:

Explanation:

import java.io.*;

import java.util.*;

import java.util.Scanner;

class Solution {

  public static void main(String args[]) {

      Scanner in = new Scanner(System.in);

     

     

      ArrayList<String> ans = new ArrayList();

     

      System.out.println("(a) ADD THREE NAMES: ");

     

      for(int i=0;i<3;i++)

      {

          ans.add(in.next());

         

      }

      System.out.println("(b) NUMBER OF ELEMENTS: " + ans.size());

     

      System.out.println("(c) ADD TWO MORE NAMES : ");

      for(int i=0;i<2;i++)

      {

          ans.add(in.next());

         

         

      }

      System.out.println("(d) PRINT ALL NAMES: ");

      for(int i=0;i<ans.size();i++)

      {

          System.out.println(ans.get(i));

      }

     

      System.out.println("(e) ENTER A NAME TO REMOVE: ");

      ans.remove(in.next());

      for(int i=0;i<ans.size();i++)

      {

          System.out.println(ans.get(i));

      }

     

     

  }

}

You might be interested in
: Each individual data items of record is called a
musickatia [10]
Each individual data items of record is called field (letter A).
The client may communicate with Proxy server to use a protocol to proxy the communication between the client and the DBMS. Proxy servers lets you hide your real Ip address and replaces it with a new IP obtained from proxy server sites.

6 0
3 years ago
What is application launchers functions​
andrey2020 [161]
An app launcher replaces the stock user interface for organizing the home screen and app icons predominantly in the Android world; however, they are also available for jailbroken iPhones (see iPhone jailbreaking and Cydia). See Launchpad.
5 0
3 years ago
A driving school uses this rule to estimate how many lessons a learner will require.
HACTEHA [7]

Answer:

This is correct. And to remove the confusion, I am adding the meaning of the Pseudocode. You need to begin with the algo that you are working upon, and then you need it to phrase the algo with the words which are easy to be transcribed in the form of the computer instructions. Now you need to indent the instructions properly inside the loop or within the conditional clauses. And while doing this, you need to not use the words which are used in certain forms of computer language. However, IF and THEN and ELSE and ENDIF are very frequently used as pseudo-code. Hence, your answer is correct.

Explanation:

Please check the answer section.

8 0
2 years ago
Por favor definir que es un pseudocódigo y que es un diagrama de flujo.
marusya05 [52]

Answer:

que

Explanation:

8 0
3 years ago
Read 2 more answers
You have installed a device that has eight interfaces and does not forward broadcast packets. What kind of device did you instal
Novay_Z [31]
A router, possibly. Thought I'm not for sure because I'm not in computers and technology

7 0
3 years ago
Read 2 more answers
Other questions:
  • What is the maximum number of colors that should be used on a slide?
    5·2 answers
  • Your computer running Windows 7 is doing some very strange things with the operating system. You are fairly certain it is not a
    10·1 answer
  • How is a computer component, such as a network card, commonly marked for identification?
    12·1 answer
  • A cooler with heat pipes, which contain a small amount of liquid that becomes a vapor when heated, allowing heat to be drawn awa
    10·1 answer
  • Read the following scenario: A project will require more people than originally estimated. Identify the possible risks to the pr
    8·2 answers
  • What is the analysis stage in System development life cycle?
    12·1 answer
  • What will the following code print out: int numbers [] = {99, 87, . 66, 55, 101}; for (int i = 1; i &lt; 4; i++) cout &lt;&lt; n
    11·1 answer
  • )In a graph represented by adjacency matrix u can find all the neighbours of a given vertices in ____Operations
    6·1 answer
  • What is meant by Information Retrieval?
    8·1 answer
  • What is the difference between the byte and short data types in Java?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!