Write a java program to read elements in an array from user and count total number of duplicate elements in array.

Answers

Answer 1

Answer:

Explanation:

The following code is written in Java and is a function/method that takes in an int array as a parameter. The type of array can be changed. The function then creates a counter and loops through each element in the array comparing each one, whenever one element is found to be a duplicate it increases the counter by 1 and moves on to the next element in the array. Finally, it prints out the number of duplicates.

public static int countDuplicate (int[] arr) {

               int count = 0;

               for(int i = 0; i < arr.length; i++) {

                       for(int j = i + 1; j < arr.length; j++) {

                               if(arr[i] == arr[j])

                                       count++;

                       }

               }

               return count;

       }


Related Questions

what is meant by astigmation​

Answers

Answer:

It is a condition where the eye isn't completely round

Explanation:

Answer:

is a common and generally treatable imperfection in the curvature of your eye that causes blurred distance and near vision. Astigmatism occurs when either the front surface of your eye (cornea) or the lens, inside your eye, has mismatched curves

Explanation:

types of network model​

Answers

Answer:

OSI Model and TCP/IP Model

Explanation:


The production team for a fictional drama is shooting a key scene. One of the actors leaves out part of his scripted dialogue that was
supposed to be included. Which member of the team would be least likely to realize or be concerned about this?

Answers

Answer:

at last sentence was . The editor's work .

Answer:

b: cinematographer

Explanation:

edg2021

Im going to be honest, it should NOT be a Cinematographer. They focus on the visuals, not the script. But this was marked correct on edg.

anybody wanna be friends?

Answers

i wouldn't mind......

yes Avacado?????????????????????

I need help with 9.1

Answers

Answer:

x=circumfrence of circle im 29 boi

Explanation:

In my 4.3 Code practice: Question 1.
Every time I enter an age, it just continues to print **HUG**
What is wrong with my code?

Answers

Answer:

you have the (while) code in whenever it is greater than 0, print hug. if less than, then nothing so flip the inequality thing around again.

Hope this helps plz hit the crown

how do you copy and paste

Answers

Answer:

ctrl+c=copy

ctrl+v=paste

Explanation:

Answer:

So depends on the site. If it is your phone you hold on the word or beginning of the sentence. Then, two blue dots will pop up. You drag it to select what you want. Then, once you let go, The words 'copy, paste, select all' should pop up. Click copy. Got to your notes or something, Hold the blank space and click paste. For computer it is almost the same thing. Use a mouse(shift+arrow key) and drag it on what you want to select. Then, press control C. Finally, go to your doc and type control v, it should pop up. Note!: You won't be able to copy and paste everything due to the website.

heeeeelp
and thank you

Answers

Answer:

2375 calories

Explanation:

125% of 1900=2375 calories

Answer:

2375 calories

Explanation:

it's asking for 125% which is the same as 100% + 25%

100% is 1900

25% of 1900 is 475

1900 + 475 is 2375

Complete the following sentences.
You can use shapes to create various
v. Conventional
associations continue even though trends keep changing.


BIG TEST NEED TO PASS IM FAILING

Answers

Answer:

symbols and symbolic

Explanation:

Which job role requires you to create user guides for computer products and services?
A
creates users guides for computer products and services.
Reset
Next
Which job role requires you to create user guides for computer products and services

Answers

Answer: Technical writer

Explanation:

A technical writer is an individual who is responsible for the creation of technical documents such as user manuals, reference guides, instruction manuals, journal articles, etc.

Technical writers can work in software firms as they would be responsible for creating user guides for computer products and services.

Answer:

The answer for the blank box is :   technical writer

Explanation:

Hopefully this is right!

have a great day/eve!

help now ASAP, and thank you

Answers

Answer: True

Oxygen is needed to combust/ignite the fuel that is mixed in, which provides the heat and thrust to push the jet forward. On a chemical level, the oxygen (O2) mixes with whatever the fuel chemical may be. Recall that oxygen is often used to burn things, due to oxygen effectively breaking the bonds of the fuel chemical and unleashing its stored potential chemical energy.

Consider the popular online retailer Amazon. What aspects of its business are run through public networks, and what aspects might be run through a private intranet?

Answers

Supporting strategic business objectives: intranets can play an active role in support high-level business objectives such as building, embedding and communicating a common culture, improving employee engagement or improving staff retention rates.

Answer: public: when amazon shows what everyone is buying or what is being sold most frequently. When you put down your review of a product and your profile.

private: when you put in your address debit or credit cards your email or phone number and more so amazon can ship the product you have bought and so you can buy the product.

Explanation: this is my first time answering a question i hope this helps :)

Noodletools is one of the Online databases available at the BLA library
website. I can print a copy and/or export a copy of my citations from
Noodletools.
True
False

Answers

Answer: true

Explanation:

USB 3.1 offers an improvement over its predecessors by enabling a maximum data transfer rate of up to:

Answers

Answer:

10 Gbps

Explanation:

The full form USB is Universal Serial Bus. It is used to connect to electronics as well as computers. The 3.1 USB is a recent and advance version of the USB standard. It was released in the year 2013. It can transfer data speed up to a speed of 10 Gbps.

It USB 3.1 can use the USB-C connector types and other connector types as well.

why is it important to have a price assiociated in every product​

Answers

Answer:

The wrong price can also negatively influence sales and cash flow. tbh there is no point to me  

Explanation:

Answer:

Price is important to marketers because it represents marketers' assessment of the value customers see in the product or service and are willing to pay for a product or service. ... Both a price that is too high and one that is too low can limit growth. The wrong price can also negatively influence sales and cash flow.

Explanation:


Nick is moving from Alabama to Texas. A friend of his remarked that Nick may have to pay higher taxes there. What is the cheapest and quickest
way for Nick to find out if his friend is right?
А.
hire a lawyer
B.
speak to an accountant
C.
talk to other friends
D
look up the Texas state website

Answers

Answer:

d is look up the Texas state website

Explanation:

because tell u about texas and taxes

what does good time management mean​

Answers

Answer:

When you are consistent with your work and not wasting time

Explanation:

Time management to me means using your time wisely and thing you have to get done do those things first before doing something that is not a must. Being wise with your time will help you complete goals and more in life.

Have a good day and a merry Christmas

Which statements are true? Select 4 options.

A class variable can be a different type of class.

A class variable can be a list of instances of a different class.

An instance of a class cannot be changed after it is created.

Functions defined in a class are called methods.

Variables defined in the constructor of a class can be accessed by the main program that uses instances of the class.

Answers

Answer: All of the answers are correct EXCEPT "An instance of a class cannot be changed after it is created.

Explanation: I've done the problem. Also, if you have an instance of a class, you can no longer change it. It is frozen in time as that one instance. If had a class defining pets and you made an instance dogA where the pet was a brown medium sized dog, dogA would always be a brown medium sized dog. I think, at least.

Answer: A class variable can be a different type of class.

A class variable can be a list of instances of a different class.

Functions defined in a class are called methods.

Variables defined in the constructor of a class can be accessed by the main program that uses instances of the class.

Explanation:

got it right on edgen

What is the answer to 4.9 Code Practice: Question 2

Answers

Answer:

sum = 0

for i in range(20, 100, 10):

sum = sum + i

Print(sum)

Explanation:

The answer to 4.9 Code Practice: Question 2 is 200  of the total output.

What is the output?

An output record that a laptop sends. Computers best paintings with virtual information. Any entry that a laptop gets have to be digitised. Often records must be transformed and returned to an analogue layout whilst it is output, as an instance the sound from a laptop's speakers.

The answer to 4.9 Code Practice: Question 2 is 200 output of all the total outputs this is the answer.

Read more about the Code :

https://brainly.com/question/3653791

#SPJ2

5. What is a domain name used for?​

Answers

Answer:

Domain names serve to identify Internet resources, such as computers, networks, and services, with a text-based label that is easier to memorize than the numerical addresses used in the Internet protocols. A domain name may represent entire collections of such resources or individual instances.

Explanation:

*Hope this helps*

What is one way to make a presentation stand out by using PowerPoint Online?

Use different images and videos throughout the presentation.

Use a plain white background throughout the presentation.

Use the same font and font size throughout the presentation.

Use the same slide format throughout the presentation.

Answers

Answer:

Answer: Use different images and videos throughout the presentation.

Explanation:

I just took this test and got it correct :)

Answer:

give person on top brainlist they are right i got 100 percent

Explanation:

thank you

Assume that x and y are boolean variables and have been properly initialized. !(x || y) || (x || y) The result of evaluating the expression above is best described as:

Answers

Answer:

The answer is "Always true "

Explanation:

Following are the program to this question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

bool x=true;//defining bool variable x and assign value

bool y=false;//defining bool variable y and assign value

if(!(x || y) || (x || y))//use given condition with if block

{

   cout<<"True";//print true message

}

else//defining else block

{

   cout<<"false";//print false message

}

   return 0;

}

In the above code two bool variable is declared, that hold ture and false, and used in the given expression with the condition statement, that checks the given value. In the code the logical gate OR gate that always print the true value.

can someone please help its late

Answers

Answer:

The correct answer to this question is given below in the explanation section.

Explanation:

The labels to AS engine are given below from left to right respectively.

FanCompressorCombustionTurbineMixer Nozzle

Fan: Drawer air into the engine

Compressor: Compressor spins the air very fast. This sequeezes or compresses the air

Combustion: Air and fuel are mixed together and ignited in the combustor and it gets super hot and gas expanded.

Turbine: The hot gases enter the turbine, causing the blade on it to spin.

Mixer: The mixer combines the hot air with outside air in the engine. This reduces the heat and noise that is coming from the engine.

Nozzle: nozzle is where the exhaust is coming out from the engine, creating thrust. It works according to newton's third law.

What happens when a sender configures the sensitivity setting of a message to Private?

The security settings of the message are raised.
The recipient must send a confirmation of receipt.
The recipient is notified that the message is private.
The recipient receives a key code to unlock the message.

Answers

Answer:

The recipient is notified that the message is private.

Explanation:

In Microsoft Outlook: This is application software that is used as an electronic messaging platform otherwise known as email.

When a sender configures the sensitivity setting of a message to Private "The recipient is notified that the message is private."

Answer:

Look at the attached file

Explanation:

I'm 100% correct as you can see

10. The technology used to weave patterns into cloth inspired the future creation of computer data storage and retrieval

True or false?!

Answers

Your answer would be false

Describe the purpose and user requirements for the website.​

Answers

Answer:

The purpose and user requirements for the website is described below in details.

Explanation:

User Requirements represent how user expectations and wherewith they will communicate with the outcome. Use the characteristics, functions, and content expressed in your summaries to elaborate on your requirements. Your user synopses should describe the responsibilities your users want to perform on your site.

What improved image quality in televisions?
A: FM technology
B: AM technology
C: color CRTs
D: black-and-white CRTs
E: coaxial cables

Answers

Answer:

coaxial cables are the answer

Jose would like to have text with predefined styles that can flow around an image in a variety of shapes and sizes
Which object should he insert into his document?

WordArt

SmartArt

shapes

images

Answers

Answer:

A) WordArt

Explanation:

WordArt can be set to the predefined styles within Word and can be set to flow and wrap around images in word.

Answer:

Word art

Explanation:

what does the windows update feature allow you to do?
a. scan email attachments
b. install important patches
c. scan for viruses
d. block pop-ups

Answers

The answer is D
Explanation: none

Answer:

B

Explanation:

The purpose of Windows Update, is to bring feature updates and hotfixes to your Windows PC, it also allows for updating services such as the Windows Defender virus definitions. However, Windows Update does not block popups, but instead installs important updates for your PC.

Which of the following is a database object which allows you to ask the database about the information it contains?
A Report
B filter
C sort
D Form

Answers

Answer:

Report

Explanation:

Report shows the information being contained by a database.

Other Questions
The fall of a body on the earth surface cannot be a complete free fall ? why when we say Mohit has Blue Eyes which part of the ice is begin referred to US blue If the interest of sum of money is 6 yrs in 3/8 of the principal . what is the rate of interest? I NEED HELP ITS TIMED How does the ocean regulate climate? 3 sentences On Saturday, you bowl at Show Place Lanes, where renting shoes costs $3 and each game bowled is $4.50. On Sunday, you bowl at Pinz where the shoe rental is $6 and each game bowled is $3. If you spent the same amount each day, how many games, g, were bowled? magnesium sulfide + nitric acid net ionic Alcoholic fermentation (2 points) i need the answer as soon as possible Graph the following system of inequalities. Complete the following sentence. The U.S. borders Canada to the _____ and the state of Alaska touches Canada in the northwest. write a c++ program that prints the intial letter of any name The chart shows the marginal cost of producing apple pies.A 3-column table titled The cost of pie production has 7 rows. The first column is labeled Pies produced per day with entries 0, 1, 2, 3, 4, 5, 6. The second column is labeled Total cost with entries 0, 1, 1.50, 1.75, 2.25, 3.50, 5. The third column is labeled Marginal cost with entries 0, 1, 0.50, 0.25, 0.50, 1.25, and 1.50.This chart demonstrates that the marginal costinitially decreases as production increases.initially increases as production increases.eventually decreases as production increases.eventually increases as production decreases. HELP!! Who ever does all these problems gets a brainlist and 50 points Humans drill wells into Earth's crust to draw out groundwater for drinking andirrigation of crops. Which spheres are interacting? *OAtmosphere, biosphere, and hydrosphereO Biosphere, hydrosphere, and geosphereGeosphere, hydrosphere, and atmosphereAtmosphere, biosphere, geosphere, and hydrosphere This is in edge and Im timed!!! Alfonso scored 18 points during his last basketball game, which was 40% of the points the entire scored. How many did the scored PLEASE HELP! FINALS D:Which statement correctly describes the process by which a prime minister takes office in a typical parliamentary democracy? A. Citizens vote for a political party and the majority party in parliament selects the prime minister. B. Citizens vote for electors that select the prime minister at a convention. C. Citizens vote directly for the candidate that they wish to be prime minister. D. Citizens vote for the prime minister from a group of candidates selected by the monarch. A metallic bond is formed between what two types of elements A container is filled with 100 grams of bird feed that is 80% seed. Tom and Sally want to mix the 100 grams with bird feed that is 5% seed to get a mixture that is 40% seed. Tom wants to add 114 grams of the 5% seed, and Sally wants to add 115 grams of the 5% seed mix. What will be the percent of seed if Tom adds 114 grams? Helppppp pleazeee!!!