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
Nookie1986 [14]
3 years ago
15

Java programming

Computers and Technology
1 answer:
Marat540 [252]3 years ago
5 0

Answer:

The program in Java is as follows:

import java.util.*;

public class Main {

public static void removeDuplicate(ArrayList<Integer> list){

 ArrayList<Integer> newList = new ArrayList<Integer>();

 for (int num : list) {

  if (!newList.contains(num)) {

   newList.add(num);  }  }

 for (int num : newList) {

     System.out.print(num+" ");  } }

public static void main(String args[]){

 Scanner input = new Scanner(System.in);

 ArrayList<Integer> list = new ArrayList<Integer>();

 System.out.print("Enter ten integers: ");

 for(int i = 0; i<10;i++){

     list.add(input.nextInt());  }

 System.out.print("The distinct integers are: ");

 removeDuplicate(list);

}}

Explanation:

This defines the removeDuplicate function

public static void removeDuplicate(ArrayList<Integer> list){

This creates a new array list

 ArrayList<Integer> newList = new ArrayList<Integer>();

This iterates through the original list

 for (int num : list) {

This checks if the new list contains an item of the original list

  if (!newList.contains(num)) {

If no, the item is added to the new list

   newList.add(num);  }  }

This iterates through the new list

 for (int num : newList) {

This prints every element of the new list (At this point, the duplicates have been removed)

     System.out.print(num+" ");  } }

The main (i.e. test case begins here)

public static void main(String args[]){

 Scanner input = new Scanner(System.in);

This declares the array list

 ArrayList<Integer> list = new ArrayList<Integer>();

This prompts the user for ten integers

 System.out.print("Enter ten integers: ");

The following loop gets input for the array list

<em>  for(int i = 0; i<10;i++){ </em>

<em>      list.add(input.nextInt());  } </em>

This prints the output header

 System.out.print("The distinct integers are: ");

This calls the function to remove the duplicates

 removeDuplicate(list);

}}

You might be interested in
What is one pass of a coding sequence called?​
Romashka-Z-Leto [24]

One pass code is final version of executable file for end user with zero error. While compile the software it give Error it give the list of error to end user further to address the issue.

<u>Explanation:</u>

In computer pass of a code is used in compiler mode of programing languages. Normally end user after completing the software development he or she will compile the software programs.

So as result compiler will  pass code in multiple sequence and make the software as executable file as standalone or execute file which executable software can understanding language.

3 0
3 years ago
Read 2 more answers
What are the max amount of warnings you get before you get banned?
Olenka [21]

Answer:

I'm not sure but I just got a warning from this person Kaite....

5 0
3 years ago
Read 2 more answers
Draw an E-R diagram for the following situation:
VladimirAG [237]

Answer:

Hi there! This question is good to check your knowledge of entities and their relationships. The diagram and explanation are provided below.

Explanation:

The entity relationship diagram for the association between the entities according to the description in the question is drawn in the first attachment. We can further simplify the relationship by removing this many to many relationship between "Chemists" and "Projects" by adding another entity called "Worklist" as detailed in second attachment.

4 0
3 years ago
The program is the set of instructions a computer obeys
rosijanka [135]

Answer:

True

Explanation:

a program is basicly just a list of commands you can run over and over again.

6 0
3 years ago
True or False: To create a function in python, you start with the keyword "def"
Butoxors [25]

Answer:

true i think

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • Imagine that you are an independent filmmaker making a feature-length narrative film in the United States, with a variety of bot
    11·2 answers
  • A document may wordwrap differently depending on the type of printer being used.
    8·1 answer
  • What does pdf stand for in computer terms?
    15·1 answer
  • What is Brainly?<br><br> A.Yes<br> B.No
    12·2 answers
  • Given the following code:
    8·1 answer
  • Which option is the primary means of communication for coauthors working on PowerPoint presentations?
    10·1 answer
  • Identify the reasons that numeric data representation is important to computer programmers. Check all that apply.
    12·2 answers
  • Define computer memory and write it's type ​
    6·1 answer
  • HELP!!!!!!!
    8·1 answer
  • What is the most likely reason a company would use enterprise software?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!