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!
Answer:
5
Explanation:
The code print out the length of the string "stuff" which equals 5.
Answer:
Option 2: Reads one value and places it in the remaining first unused space endlessly.
Explanation:
Given the code as follows:
- int[] a = {1, 3, 7, 0, 0, 0};
- int size = 3, capacity = 6;
- int value = cin.nextInt();
- while (size < capacity && value > 0)
- {
- a[size] = value;
- }
The a is an array with 6 elements (Line 1). The program will prompt the user for an integer and assign it to variable <em>value </em>(Line 3).
The while loop have been defined with two conditions, 1) <em>size < capacity </em>and <em> value > 0</em>. The first condition will always be true since the size and capacity are <em>constant</em> throughout the program flow and therefore<em> size</em> will always smaller than capacity.
Hence, if user input an integer larger than 0, the while loop will infinitely place the same input value to the remaining first unused space of the array, <em>a[3]</em>.
Answer:
Page view and outline view available in "View" Tab.
Explanation:
<u>Page View:</u>
<u>There are four types of page views available in word.</u>
<u>1. Normal: </u>(Useful when we need to write more text in word)
<u>2. Web layout: </u>(Use only when we are creating a website)
<u>3. Print layout: </u>(It is used to show the left, right, top and bottom margin for printing)
<u>4. Outline View:</u> (Used to make outline of whole document)
He should probably check the reviews of the mp3 player and the seller accuracy.