In a program, write a method that accepts two arguments: an array of integers and a number n. The method should print all of the numbers in the array that are greater than the number n (in the order that they appear in the array, each on their own line).
In the same file, create a main method and call your function using the following data sets:
The array {1, 5, 10, 2, 4, -3, 6} and the number 3.
The array {10, 12, 15, 24} and the number 12.
My code:
public class LargerThanN
{
public static void print(int[] array,int n)
{
for(int i=0; i {
if (array[i]>n)
System.out.println(array[i]);
}
System.out.println();
}
public static void main(String[] args)
{
int[] array1 = {1,5,10,2,4,-3,6};
int num1=3;
print(array1,num1);
int[] array2 = {10, 12, 15, 24};
int num2 = 12;
print(array2, num2);
}
}
My programming lab does not want extra lines between the output. What am I doing wrong? How do I fix it?

Failed Test Run
The contents of your standard output is incorrect.
Attention: the difference between your stdout and the expected stdout is just a question of spacing.
Standard Output Hide Invisibles
Your Code's Actual Result:
Expected Result: 5
5 10
10 4
4 6
6
15 15
24 24

Answers

Answer 1

Answer:

move the System.out.println(); outside the for loop.

Explanation:

see picture. I shortened the main() method a bit, for fun.

In A Program, Write A Method That Accepts Two Arguments: An Array Of Integers And A Number N. The Method

Related Questions

Devising a plan to solve a problem or perform a task using a set of step by step instructions is called:
Running a program
Writing an algorithm
Creating syntax
Interpreting instructions

Answers

d becaus ig is following INSTRUCTIONS

How does a Red Team vs Blue Team exercise help an organization

Answers

Answer:

Kindly check explanation

Explanation:

The Red team VS Blue team exercise can be explained as a simulated form of exercise or challenge which is intentionally triggered by an organization in a bid to test and access its level of security in other to stay in top of an actual external threat that might be perpetrated. In the simulated exercise, the red team act as the attacker by deploying several forms of threats which are used by actual attackers. The blue team on the other hand act as guard to repel tune attack. All these helps organizations to detect possible weaknesses and loopholes in their system which they can improve on in other to promote system and information security.

How does the pay for many Science, Technology, Engineering, and Mathematics workers compare to the overall median for all careers? It is far lower than the overall median. It is far higher than the overall median. It is slightly higher than the overall median. It is about the same as the overall median.

Answers

Answer:

B

Explanation:

It just is

Answer:

B is correct

Explanation:

Josh wrote the following e-mail to his co-worker. PLEASE HELP QUWICK



i need the figues to enter them into my DBA presentation. ASAP. please send.

This is an example of _____.


effective communication

nonverbal communication

ineffective communication

workplace communication

Answers

Answer:

Answer choice 4

Explanation:

If Josh sends an e-mail to his... co-worker.... wouldn't that be... workplace communication?

D because he is sending a email to his coworker making it workplace communication

You want to substitute one word with another throughout your
document. What tool(s) should you use?
O Cut and Paste
O Dictionary
O Find and Replace
O Copy and cut

Answers

I’m pretty sure it’s “Find and paste”

In order to ask for user for input in store the results as a stream, you should use the function. Readline, readlnt, string, algorithm

Answers

Answer: String

-DoggyMan5

Pls help I will give points

Answers

Answer:

Laptop

Explanation:

A keyboard would be considered _____. Select 2 options.

Answers

Answer:

What are the 2 options?

Explanation:

Answer:

Do you have the options?

Explanation:

А ______
network is good for connecting computers over boundaries.
campus area
local area
wide area
system area

Answers

Answer:

wide area network (WAN)

Explanation:

Answer: B. Local area

A local area network is good for connecting computer clusters

6. What is a search engine?
a program that searches engines
a web site that searches anything
a hardware component
a machinery engine that search data

Answers

It is a web site that searches anything

Answer:

It is a web site that searches anything, the guy above me was Correct EDGE 2022!

Explanation:

Count operation Lucky twos
Lucky Twos determines and displays the number of digits that are 2s in a whole number. For example, the number of 2s in 3487 is 0, while the number of 2s in 272521 is 3. Note: whole numbers are non-negative integers starting at zero 0, 1, 2, 3, 4.
Assume that the fractional part is discarded in the division:
10 / 4 = 2
8 / 5 = 1
20 / 3 = 6
Read number
set count to 0
while number > 0
If the number module 10 is Then add
1 to count
End If
Compute number as number / 10
End while
Display count.
Let n be the number of digits of the whole number. What is the number of operations that are executed in the code in terms of n?

Answers

Answer:

Following are the solution to this question:

Explanation:

Its complexity of both the pseudo-code described is indeed proportional to the number of digits. So, how often number there are in this specific number is the query. Whenever a number is considered, the d digit would be between [tex]10^{(d-1)}.[/tex] inclusive exclusive [tex]10^d[/tex] That would be as, let d become the number of digits at N, and the inequalities, They can tell

[tex]10^{(d-1)} \leq N < 10^d[/tex]

We get, we take a logarithm,

[tex]d-1 \leq \log(N) < d[/tex]

The increase of 1 to the left inequality, [tex]d \leq \log(N)+1[/tex], and Combining the previous outcome, we got, [tex]\log(N) < d \leq \log(N) + 1[/tex]. That's would be to say, that number of number d by [tex]O(\log(N))[/tex] is higher and lower. Consequently, the number of transactions in the code is [tex]O(\log(N))[/tex]

We have that the number of operations that are executed in the code in terms of n  is mathematically given as

The quantity of operations done in the code is O(log(N))

Operation

Generally the equation for the   is mathematically given as

If we think about a number,

with d digits is between 10^(d-1) inclusive and 10^d exclusive.

Let d be the wide variety of digits in N

10^(d-1) <= N < 10^d

d-1 <= log(N) < d

d <= log(N) + 1,

The Inequality

log(N) < d <= log(N) + 1.

Therefore

The quantity of operations done in the code is O(log(N))

For more information on Inequality visit

https://brainly.com/question/19491153

Why do we use return statements? Choose all that apply

A.
Javascript requires functions to have return values.

B.
To return multiple data types simultaneously

C.
To allow a function to give different values depending on input.

D.
So that we no longer have to use console.log();

E.
To save the result of a function in a variable in other functions

Answers

Answer:

A.

Javascript requires functions to have return values.

What do you call the parts of the motor that do not move?.

Answers

Answer:

The stator..?

Explanation:

Stators are the stationary parts of motors. Dunno if I'm right lol

To have integrity means that you

Answers

You are honest and disciplined

How does Windows operating system manage the file?​

Answers

Answer:

The OS allows you to organize the contents of your computer in a hierarchical structure of directories that includes files, folders, libraries, and drives. Windows Explorer helps you manage your files and folders by showing the location and contents of every drive, folder, and file on your computer.

Suppose we want to prove the statement S(n): "If n ⥠2, the sum of the integers 2 through n is (n+2)(n-1)/2" by induction on n. To prove the inductive step, we can make use of the fact that 2+3+4+...+(n+1) = (2+3+4+...+n) + (n+1) Find, in the list below an equality that we may prove to conclude the inductive part.

a. If n ⥠3 then (n+2)(n-1)/2 + n + 1 = (n+3)(n)/2
b. If n ⥠1 then (n+2)(n-1)/2 + n + 1 = (n+3)(n)/2
c. If n ⥠2 then (n+2)(n-1)/2 + n + 1 = (n+3)(n)/2
d. If n ⥠1 then (n+2)(n-1)/2 + n + 1 = n(n+3)/2

Answers

Answer:

The answer is "Choice c".

Explanation:

Please find the complete question in the attached file.

To begin with, allow its principle of the numerically solving to be recognized, three stages are concerned.

1. Topic n=1

2. Suppose n to be true

3. Display n+1 it retains

We have LHS as 2+3+ for the third step now [tex](n+1) = (2+3+.. \& n) + n+1[/tex]

We can now replace the bracket of RHS by [tex]\frac{(n+2)(n-1)}{2},[/tex]as we assumed its valid for n in step 2

if we do that we get

[tex]= \frac{(n+2)(n-1)}{2+(n+1)}\\\\= \frac{(n^2-n+2n-2+2n+2)}{2}\\\\= \frac{(n^2+3n)}{2}\\\\= \frac{n(n+3)}{2}[/tex]

Pls help me awnser this I will give points

Answers

Answer:

first one is "int" second one is "string" and third one should be "float"

Explanation:

not sure if the first one is right but try this.

Pls help I will thx and give points

Answers

Answer:

Desktop

Explanation:

A tablet and smartphone dont have enough storage like a desktop, so they would edit very efficiently

A desktop. A desktop has more advanced features than a tablet or smartphone. More programs are available and storage is more widely available as well

Which of the following items are present in the function header?

A. function name and parameter (variable) list

B. parameter (variable) list

C. return value

D. function name

Answers

Where is the function header you speak of ?
Variable list. Variables always come first

Is the quote "Stay inside and have water and food ready in case power goes out" a definition of...

A. Thunderstorm
B. Winter storm

Answers

Answer:

winter storm

Explanation:

possibility of a snow-in.

Answer: winter storm

jeff has just upgraded from windows 7 to windows 10 and he is confused. He has started several universal apps but he can't figure out how to close them. how would you explain the process for closing a universal app?

Answers

Answer: Find the app you want to close, then go to the moveable panel and click the X.

besides earning money why do people work​

Answers

Answer:

to make a name for themselves

Explanation:

besides earning money some people actually enjoy their job and do it simply because they like it others do it because they genuinely want to help people for example, people who work in the medical field who actually care abt their patients

EASY What does the Backspace key do?

O Inserts characters behind (or to the left of) the insertion
point.
O Removes characters behind (or to the left of) the insertion
point.
O Removes characters in front of (or to the right of) the
insertion point
O Inserts characters in front of (or to the right of) the insertion
point.

Answers

Answer:

Removes characters behind (or to the left of) the insertion point.

Explanation:

“A school is looking to build a new 30 desktop PC computer suite. The school has limited funds available. The PCs will have a lot of different software installed as well as an operating system and multiple students’ profiles.” [6 marks]

Answers

Answer:

it depend on the software the computer has along with how much data it can hold

Explanation:

Answer:

Depends on the software code the computer has

Explanation:

How does critical thinking relate to peer
assessment ?

Answers

Answer:

It both helps you understand very well on whatever assessments reading you do. You think and you pay 100% to your work and get done with it. You think through whatever you've been working on.

There are several possible reasons why a high percentage of IT projects are abandoned-the business strategy changed, technology changed, the project was not going to be completed on time or budget, the project sponsors responsible did not work well together, or the IT strategy was changed to cloud or SaaS.

a. True
b. False

Answers

Answer:

a. True

Explanation:

The above listed information are part of the reasons why so many IT projects are abandoned by the business entities after a given period of time frame.

In the binary system, 1 and 0 are not known as digits. Instead, they are called
bits
switches
flow
variables
decimals​

Answers

Answer:

Variables

Explanation:

I hope it helps

Answer:

C variables

Explanation:

Which save as element allows a user to save a presentation on a computer?

Answers

Answer:

This PC

Explanation:

Got it right

Answer:

Look at the attached file for the answer, I'm correct as you can see.

Explanation:

Select four examples of fluid or pneumatic power systems.
crane
dentist's chair
barber's chair
bulldozer
calculator
wheelchair

Answers

Crane and barbers chair

The science of how an object reacts to its motion through air is called _______________. (12 letters)
HURRY!!!

ANSWER CORRECTLY AND YOULL GET BRAINLIEST

Answers

Explanation:

friction drag that is your answer 12 letters

Answer:

drag

Explanation:

im not the brightest but in the sentients it should have "drag" in it but u can listen to others answers to make sure

Other Questions
How did the ability to plow vast tracts of land change the economic value of the land in the southern Plains? Hi guys can you answer my math question Complete each sentence below with the correct form of hacer, poner, traer, salir, or venir.Yo ____ mi maleta en la bscula.Not multiple choice Use the context to determine the connotation/s of the underlined word. When I failed the test, it made m English e really blue. Use the context to determine the connotation/s of the underlined word PLEASE HELP ASAP What country is shaded on map Four families share a basket of 16 kilograms equally how many kilograms of apples does each family get? !!!!!!!!!PLEASE HELP ME!!!!! Ernesto received a raise in his hourly pay, from $20.65 to $23.55. find the percent change round to the nearest tenth of a percent Can someone help plz A compound inequality is graphed, and its graph consists of all real numbers. Which open sentence could have resulted in this solution set?A. r < 3 or r > 2B. r > 3 or r > 2C. r < 3 or r < 2D. r > 3 or r < 2 Your prediction is that of the offspring would have the dominant phenotype, andoffspring would have the recessive phenotype. PLZ HELPPPPPPP!!!!!!!!!!!!!!! What is this in english estoy en la escuela y tu estabas Find the unknown coordinate so the line through the points has a given slope.(2, Y), (4, 20); slope = 5 Marcus collects donations and sends care packages to troops overseas. He has 36 bars of soap and 24 toothbrushes and wants to arrange the items so the packages are identical. What is the greatest number of packages that Marcus can make using all the soap and toothbrushes? ) What is the greatest number of packages of soap and toothbrushes that Marcus can make? Marcus can make at most 12 packages. ) How many bars of soap and toothbrushes are in each package? 2 toothbrushes in each pockage 6) There are ? bars of soap and ? toothbrushes in each package? p(n) = n^2 - 5n; Find p (4) Find the slope given: (-2,-1) & (-8, 11)m = please help view the attached screenshot below. What's the answer to 6 + 5 + (26 - 19) - exponent 6 over 5 A car can go from 0m/s to 27 m/s in 4.5 seconds. If a net force of 6,600 N acted on the car , what is its mass? (Hint: solve for acceleration 1st) Who introduced a set of 12 amendments for the Constitution during the first session of Congress?