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
Jane wants to add a chart to her presentation so she’ll click the Insert tab and in the Images group, she’ll click the Chart but
kap26 [50]

(A. Stevie only) because You need to go the illustrations tab in order to click on the chart button.

Jane clicked on images tab so she was wrong.

Mark as brainlest plz :)

3 0
3 years ago
Which of the following is not an advantage of a flowchart?
ad-work [718]

Answer:

d) Improper documentation

Explanation:

A flowchart is a type of diagram in which it presents the flow of the work or how the process is to be followed. It is a diagram that represents an algorithm that defines step by step approach to solving the task. In this, there are various boxes that are linked with the arrows

There are various advantages like in this, there is a better communication, coding is to be done in an efficient way, system could be tested also there is a proper documentation

hence, the correct option is d

4 0
3 years ago
Where could page numbers appear in a properly formatted business document?
Stels [109]
At the bottom right is the perfect place
6 0
4 years ago
Read 2 more answers
Four friends bought three same-sized pizzas for dinner.
o-na [289]

Answer:

9/8 of a pizza

Explanation:

3/4 -> 6/8

1/2 -> 4/8

5/8 -> 5/8

We can now add all of these:

6/8 + 4/8 + 5/8 = 15/8

The total amount of pizza is 24/8 because there are 3 pizzas.

24/8 - 15/8 = 9/8

6 0
3 years ago
Define las 3 fases de la economia y explica en que espacios se localizan​
navik [9.2K]
Can you like translate it to English so I can understand lol
7 0
3 years ago
Other questions:
  • What is an embedded system. Give examples
    12·1 answer
  • If x is an int, which of the following statements adds 5 to the current value of x and stores the new value back in x?
    12·1 answer
  • Why would advertising be more important in a magazine publishing than it is in a newspaper?
    14·2 answers
  • Which of these sedimentary rocks is made of the largest particles?
    10·1 answer
  • Which of the following do you need to remeber about true/false questions?
    12·1 answer
  • Web browsers are used to browse the world wide web.
    5·2 answers
  • Can anyone help me<br> I will make you a brainalist
    13·1 answer
  • This morning when Paul turned on his computer at work, it would not boot. Instead, Paul reported that he heard a loud clicking n
    15·1 answer
  • 45 points!!
    15·2 answers
  • I have a problem. I can't cycle between game packs on my strike pack, I've watched so many vids I'm on Xböx and I'm holding the
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!