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
How long would you need to work at McDonalds to earn enough money to buy a optiplex 3050, monitor, mouse and keyboard all from d
r-ruslan [8.4K]
So assuming you were buying this piece of trash with the mouse and keyboard it would be around $450. Average pay per hour is $9.10-$10.20 depending on were you live so we will just say $9.50. You'd need to work rougly 47 hours (without taxes) So i'd say 65-75 Hours.
8 0
3 years ago
Read 2 more answers
The true or false questions.<br><br> 1.egrep can accept multiple filenames as input arguments.
BlackZzzverrR [31]

Answer: True  

Explanation: yes, it is true that egrep can accept multiple filenames as input arguments for example egrep -r "text1/text2", so this will search in all the sub directories . E grep is also known as 'grep -E' which belongs to the group of grep function and we used egrep to separate multiple patterns for OR conditions. This is also very less time consuming if you are going to search multiple input arguments in multiple different logs at the same time.

5 0
3 years ago
A counter is a tool used to measure the number of times people visit a Web site. true or false?
Liono4ka [1.6K]

True.

It doesn't measure unique users, so you can just hit refresh and the counter keeps going up...

5 0
3 years ago
An example of an asset that is both personal-use and personal property is:•A. A computer used solely to monitor the CEO's invest
kati45 [8]

Answer:

Option A is correct.

Explanation:

The following is an illustration of such a resource which is also personal usage as well as corporate capital, that system required primarily to track the contribution of both the Chief executive and also to execute the Form 1040.

  • Option B is incorrect because the system required exclusively to email workers concerning the operations of the organization isn't an illustration of such a resource which is both personal usage and commercial property.
  • Option C is also incorrect because it is seen that the following option is not the illustration of such a scenario.
  • Option D is incorrect because the storage facility being required through the Chief executive to preserve confidential documents is not the correct illustration of such a scenario.
  • Option E is incorrect because there are not all the resources are for the personal as well as commercial use.
7 0
2 years ago
When editing the master slides, if you edit the layout on the title page, those changes appear on:
Fed [463]

D. only the first title slide in the presentation.

4 0
3 years ago
Read 2 more answers
Other questions:
  • How to delete audio from powerpoint​
    13·1 answer
  • How is the United Kingdom planning to use driverless cars beginning in 2015?
    15·2 answers
  • What character separates the file extension and the filename?
    13·2 answers
  • Step 1: Configure the initial settings on R1. Note: If you have difficulty remembering the commands, refer to the content for th
    10·1 answer
  • Machu Picchu is located in modern day _______<br><br>​
    14·2 answers
  • In the value chain concept, upgrading IT is considered what kind of activity?
    9·1 answer
  • Which function calls would provide the most helpful test of this function? Remember: With tests, you are attempting to figure ou
    5·1 answer
  • What are the characteristics of calendar sharing options in Outlook 2016? Check all that apply.
    13·2 answers
  • What is a collection of computing resources that are elastic and highly virtualized?
    14·1 answer
  • 8.1.4: Ghost Invasion!
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!