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
The U.S. National Institute of Standards and Technology defines the incident response life cycle as having four main processes:
GuDViN [60]

Answer:

C. Post-incident activity.

Explanation:

An incident is a event of intrusion or attack or violation of an attempt of an attack. An incident response is an opposing response to an attack or violation.

An incident response life cycle are stages followed to mitigate a current attack or violation. The stages of the incident response life cycle are, preparation, detection and analysis, containing and eradicating and recovery, and post incident activity.

7 0
3 years ago
En un taller tienen dos taladros de sobremesa de 600 w de potencia, una sierra de calar de 500 w y cuatro soldadores de 50 w. Lo
sveticcg [70]

Answer:

El consumo del taller es de 3.7 kw/h.

Explanation:

Dado que el taller posee dos taladros de sobremesa de 600 vatios de potencia, que son utilizados durante 2 horas diarias; una sierra de calar de 500 vatios de potencia que es utilizada durante 1 hora diaria, y cuatro soldadores de 50 vatios que se utilizan durante 4 horas diarias, para medir el consumo diario de energía del taller es necesario realizar el siguiente calculo:

600 x 2 x 2 = 2,400 vatios de consumo taladros

500 x 1 x 1 = 500 vatios de consumo sierra de calar

50 x 4 x 4 = 800 vatios de consumo soldadores

2,400 + 500 + 800 = 3,700 vatios de consumo total

Pasado a kilovatios, el consumo del taller es de 3.7 kw/h.

4 0
3 years ago
IMPORTANT HELP
balu736 [363]

Answer:

plz am so sorry I don't no it

Explanation:

Plz give me brainiest

6 0
3 years ago
--- is a set of applications that manages the activities and resources of a computer.
hammer [34]
D. System Software 
is responsible for Manage activity 
4 0
3 years ago
50 Points Will Give brainliest Help (right answers only please)
gulaghasi [49]

Answer:

The boss, since it’s none of her business that Delilah’s appointment was for mental health, and asking for a doctor’s note after the fact is harassment, and docking her pay might be illegal.

That's what I think (I hope I'm right).

6 0
3 years ago
Read 2 more answers
Other questions:
  • On a wireless router, what gives out IP addresses?<br> DHCP<br> DNS<br> WPA<br> WPS
    10·1 answer
  • Anchor hyperlink to position the cursor to the section called sisters? i need a code pls
    15·1 answer
  • Create a button to play the playlist <br><br> Java, netbeans
    7·2 answers
  • Universal Containers has a requirement to integrate Salesforce with an external system to control record access. What option sho
    11·1 answer
  • "You are working on a Debian distribution of Linux. You need to install a package, but you do not want to manually install all t
    8·1 answer
  • "Save" or "save as" can be used interchangeably and have no unique features.<br> True<br> False
    12·2 answers
  • Which statement gives an advantage of multicellular organisms?
    7·2 answers
  • There u go i did thereeeeeeeeeeeeeeeeeeeeeee
    13·2 answers
  • Which of the following offers more reliable antivirus protection? Question 43 options: A) antivirus software on user PCs B) anti
    10·1 answer
  • Writing queries in sql to compile data from a database is related to the physical level of databases true or false?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!