Question
IN JAVA Write a program named ZipDuplicates that reads in three zip codes from standard input and writes to standard output a single integer and
IN JAVA
Write a program named ZipDuplicates that reads in three zip codes from standard input and writes to standard output a single integer and nothing else. The integer it prints out is the number of duplicates in the sequence of zip codes. Thus, it will print out 0, 1 or 2: 0 is printed if each zip code is unique. 1 is printed if only two of the zip codes are the same. 2 is printed if all three are the same. So, if the input to the program is 11210 11217 10003 then the output would be: ------------------------------------ 0 ------------------------------------ But, if the input to the program is 11210 11210 11210 then the output would be: ------------------------------------ 2 ------------------------------------
CONSTRAINT: Use a method to determine and return the number of duplicates.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started