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
How do design elements and color work together on a web page?
KiRa [710]

Answer:

The answer I believe is: 2. Both Enhance visual appeal.

Explanation:

4 0
2 years ago
A calculator is not a computer because​
Lady_Fox [76]

\huge\fbox\red{❥answer}

By definition a computer is an electronic device used to store and compute data. So, by definition a calculator stores and interprets data/numbers, and that makes it a computer. However, a computer can also use programs, and manipulate stored data to complete those programs.

hope it helps!! :D

8 0
3 years ago
In C++ :
elena-s [515]

Answer::

//Program is written in C++ Programming Language

// Comments are used for explanatory purpose

#include

#include

#include

#include

using namespace std;

int main(){

ifstream file; // File stream object

string name; // To hold the file name

string inputLine; // To hold a line of input

int lines = 0; // Line counter

int lineNum = 1; // Line number to display

// Get the file name.

cout << "Enter the file name: ";

getline(cin, name);// Open the file.

file.open(name.c_str());// Test for errors.

if (!file){

// There was an error so display an error

// message and end the PROGRAM.

cout << "Error opening " << name << endl;

exit(EXIT_FAILURE);

}

// Read the contents of the file and display

// each line with a line number.

// Get a line from the file.

getline(file, inputLine, '\n');

while (!file.fail()){

// Display the line.

cout << setw(3) << right << lineNum<< ":" << inputLine << endl;

// Update the line DISPLAY COUNTER for the next line.

lineNum++;// Update the total line counter.

lines++;// If we've displayed the 24th line, pause the screen.

if (lines == 24){

cout << "Press ENTER to CONTINUE...";

cin.get();

lines = 0;

}

// Get a line from the file.

getline(file, inputLine, '\n');}

//Close the file.

file.close();

return 0;}

8 0
3 years ago
Can you think of any other disruptive or nontraditional ways of earning that you could use the Internet?
denis23 [38]

Explanation:

The internet is a tool that has revolutionized the way communication is carried out. As it is a dynamic tool with easy access for any user, it is possible to use different platforms or social media to realize disruptive or non-traditional forms of earnings.

Some of them could be the dissemination of links that would generate advertising for other companies, or the free dissemination in social media of services, and several other innovations that use the internet as the main means to manufacture an extra income, such as online teaching, advertising for third parties etc.

7 0
3 years ago
At _________ the ip header is exposed and so filtering or firewalls can be applied to ip addresses. select one:
zvonat [6]
T<span>he IP packet header is what tells an IP-based host what to do with the packet that was received. 
</span>The TCP/IP<span> model describes the </span>protocols used by the Internet. The third layer is the Network layer and in the case of the Internet (the Internet Protocol IP). <span>The </span>Internet layer<span> is responsible for addressing, packaging, and routing functions.</span>
At layer 3 the IP header is exposed and so filtering or firewalls can be applied to IP addresses. 
7 0
3 years ago
Other questions:
  • A new computer workstation has been installed in a small office. the user of the workstation can print a document using a networ
    9·1 answer
  • The first documented use of work release was in the ____.
    13·1 answer
  • Under what circumstances are composite primary keys appropriate?
    5·1 answer
  • Discuss anomaly detection.
    5·1 answer
  • Technician A says that if you add pre-lube to a sealing lip of an axle seal, it will cause the seal to leak causing the bearings
    8·1 answer
  • Taken together, the physical and data link layers are called the ____________________. Internet layer Hardware layer Internetwor
    15·1 answer
  • Front and rear camber and toe settings are being adjusted during a four-wheel alignment. The correct order for performing these
    13·1 answer
  • business information management professionals also perform duties of _ information system professionals
    11·1 answer
  • EASY POINTS what favorate food<br> so easy
    7·2 answers
  • Which of the following is not a responsibility of an operating system?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!