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
You copy several files from one folder to another folder within the same drive. what permissions do the files in the destination
cricket20 [7]
They have the same permissions in the destination folder as in the original folder
3 0
3 years ago
Match the data type to their correct explanations,
sergejj [24]

Answer:

I'm positive memo is "allows inserting a large amount of text including numbers" i just took the test on Plato and got everything wrong but that one

4 0
3 years ago
Read 2 more answers
Should a social network own our social data? Is it an invasion of privacy for social networks to collect and use the information
Svetradugi [14.3K]

Answer:

The description for the given question is described in the explanation section below.

Explanation:

No, we don't even own our identity data on social networking sites. It may be said as permission is needed as an factor for recognizing an acceptable interpretation and solution to a circumstance as well as a method to be followed.

  • They would conclude that, in contemplating the data generated from social networking, this could be recognized that although the data that they left as our electronic fingerprints must be used with applications that can provide the businesses with the appropriate strategy to best reach the consumer.
  • With all this into consideration, the method of information gathering does not include personal identifying information, and also the reality that we must be made mindful of what details has been accessed as well as the right to get out of obtaining such details from the social platform.
3 0
3 years ago
Create a single line comment that says ""Print results to screen""
levacccp [35]

Answer:

//""Print results to screen""

Explanation:

In c,c++,java,javascript // is used for the single line comment.

syntax:- // comment.

Whatever text that is followed after // is commented means this line will not get executed by the compiler.

Comments are used to explain the code to other person who is working on the code or trying to understand that code.

6 0
3 years ago
Suppose a program written in language L1 must be executed on a machine running a program running in language L0. What important
Whitepunk [10]

Question Completion with Options:

a. Translation of the entire L1 program into L0 code

b. Translation of the L0 program into L1 code

c. Creation of a language L3 that interprets L0 instructions

d. Interpretation of each L1 statement using L0 code as the L1 program is running.

Answer:

The important operations that must take place in this scenario are:

a. Translation of the entire L1 program into L0 code

d. Interpretation of each L1 statement using L0 code as the L1 program is running.

Explanation:

Translation enables decoding to take place.  This means that the L1 program is decoded into a language that the L0 program can understand and execute.  Without this translation, the higher level language of L1 will not be understood by the machine language of the L0 programs.  Translation of a code creates a shared understanding, thereby easing program execution.  Code translation is simultaneously accompanied by interpretation.

8 0
3 years ago
Other questions:
  • By default, text is ______aligned and values are______________aligned
    6·1 answer
  • A ____ is text and graphics that print at the bottom of every page.
    12·1 answer
  • Dr. Robbins wants to know if there are different opinions regarding the value of public school education between Native American
    11·1 answer
  • What would you need to install if you have an app that is incompatible with your current operating system?
    13·1 answer
  • Can someone help me with these questions it's for drivers ed
    10·1 answer
  • A local bank has an in-house application which handles sensitive financial data in a private subnet. After the data is processed
    15·1 answer
  • Visual Design includes 4 elements: shapes, texture, lines and form.
    6·1 answer
  • For which tasks would Excel be useful? Check all that apply.
    7·1 answer
  • Question 2 of 10
    15·1 answer
  • What is containment and why is it part of the planning process
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!