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
NeX [460]
3 years ago
5

Write a filter that reads in a sequence of integers and prints the integers, removing repeated values that appear consecutively.

For example, if the input is 1 2 2 1 5 1 1 7 7 7 7 1 1 1 1 1 1 1 1 1, your program should print 1 2 1 5 1 7 1.
Computers and Technology
2 answers:
lara31 [8.8K]3 years ago
7 0

Answer:

Following is the code for filter:

public class filter

{ public static void main(String[] args)

{ int x = StdIn.readInt();

System.out.print(" " + x + " ");

while(!StdIn.isEmpty())

{ int y = StdIn.readInt();

    if(y != x)

          System.out.print(" " + y + " ");

    x = y;

    }

    }

    }

Explanation:

  • A public class filter is used.
  • The main function will accept a single argument as string[], it is also known as java command line argument.
  • Now the Stdln.readInt is used to read the integers in the sequence and store it in integer x.
  • The value stored in variable x will be printed using System.out.print
  • Now unless the Stdln.readInt gets an empty value, check each value of sequence and store in variable y.
  • If y is not equal to previous value x, print it and shift the value of y into x.
  • Repeat the loop again.

i hope it will help you!

kykrilka [37]3 years ago
4 0

Answer:

Computer

Explanation:

You might be interested in
You have just purchased a server with Windows Server 2016 Datacenter Edition installed. The server has 4 GB RAM, a 200 GB hard d
Elena L [17]

Answer:

a. Install more RAM

Explanation:

According to my research on information technology, I can say that based on the information provided within the question this server will not work for you purpose unless you install more RAM. This is because Hyper-V server's have a minimum requirement of 4gb, therefore if you want to run 2 servers you can divide all the resources you have since they are enough but not the RAM since you only have the bare minimum for one server. You need to add atleast 4 gb more of RAM.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

4 0
3 years ago
What type of bus does PCI use?
Vera_Pavlovna [14]

Answer:

PCI uses a 32-bit or 64-bit parallel bus.

8 0
2 years ago
Is there apps/ websites like brainly?
Virty [35]

Answer:

Mathpix Snip, Socratic, Microsoft Math Solver....etc.

Explanation:

Hope this helps! :)

6 0
2 years ago
Read 2 more answers
Your data warehousing project group is debating whether to create a prototype of a data warehouse before its implementation. The
Dvinal [7]

Answer:

Hmmm, what would i recommand i think you Should learn skills and become innovative  

Explanation:

Sir i'm gonna go toilet and come back

7 0
2 years ago
Consider the folloeing website URL:http://www.briannasblog.com. What does the "http://" represent?
Alex Ar [27]

i believe the answer would be (A) because HTTPS stands for Hypertext Transfer Protocol


6 0
2 years ago
Other questions:
  • What type of Windows Server is the most likely server to be targeted by a computer hacker?
    13·2 answers
  • 1) what are two functions of a pick or count condition?
    5·1 answer
  • A structure that specifies which of a number of permitted data types (e.g. integers) that may be stored in its instances is:
    6·1 answer
  • While creating a sketch, what helps you identify positive and negative space?
    13·1 answer
  • Linda subscribes to a cloud service. The service provider hosts the cloud infrastructure and delivers computing resources over t
    10·1 answer
  • Write a function called missing_letters that takes a string parameter and returns a new string with all the letters of the alpha
    7·1 answer
  • In ____________________ testing, security personnel simulate or perform specific and controlled attacks to compromise or disrupt
    10·1 answer
  • When Adobe Photoshop was released for the first time? A: 1984 B: 1990 C: 1991 D: 1992
    8·1 answer
  • PLS HURRY <br> Look at the image below
    8·1 answer
  • How to use boolean to check if math answer is correct java
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!