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
Svetlanka [38]
2 years ago
8

Write a public static method named evens that takes in 1 argument int a, and returns a String containing all positive even numbe

rs with each separated by a comma from O up to that number inclusive if it is also even
Remember if the argument is odd not to include it in the output
Remember there should be no trailing comma after the values
If the argument a is negative return a String that says "NONE!
(Do not print the String)
Example evens(5) String returned by method. 0.2.4
Example evens(8) String returned by method. 0.2.4,6,8
Example evens (9) String returned by method 0.246,8
Example evens(-5), String returned by method: NONE
Example evens(O) String retumed by method 0
Example evens(1) String returned by method 0
Computers and Technology
1 answer:
topjm [15]2 years ago
4 0

public class JavaApplication48 {

   public static String evens(int a){

       String txt = "";

       if (a < 0){

           return "NONE!";

       }

       else if(a%2 == 1){

           a -= 1;

       }

       for (int i = 0; i <= a; i+=2){

           if (i < a){

               txt += i+",";

                       }

           else{

               txt += i;

           }

       }

       return txt;

   }

   public static void main(String[] args) {

       System.out.println(evens(1));

   }

   

}

I hope this helps!

You might be interested in
Indicate whether the following statements are true or false:
postnew [5]

Answer:C

Explanation:I got it correct on the computer

7 0
3 years ago
Read 2 more answers
While a remote assistance session is in progress, what keyboard key(s) can the requestor press to terminate the connection?
o-na [289]

ESC key can the requestor press to terminate the connection.

<h3>what is the ESC key?</h3>
  • The European Society of Cardiology is a professional organization that strives to increase scientific knowledge of the heart and vascular system as well as the prevention, diagnosis, and treatment of disorders of the heart and blood vessels.

To learn more about ESC key, refer

to brainly.com/question/25689052

#SPJ4

8 0
2 years ago
Robert's computer is not starting due to an error in the BIOS. Which of these chips could have malfunctioned? Select the correct
timofeeve [1]

Hi;

In the question, Robert gives the explanation that there is an error in the BIOS. A BIOS (Standing for Basic Input & Output System) is a ROM chip, and is vital for the computer to initialize devices such as RAM, the CPU, etc. If there is ever an error there, a computer simply cannot boot.

From the options given, your answer given would be C. ROM.

I hope this helps!

8 0
3 years ago
Describe the components of the Ethernet frame in detail?
Marta_Voda [28]
Starts with an Ethernet header, which contains destination and source MAC addresses as its first two fields
7 0
3 years ago
How many bits must be “flipped” (i.e., changed from 0 to 1 or from 1 to 0) in order to capitalize a lowercase ‘a’ that’s represe
Neporo4naja [7]

<span>To capitalize lowercase “a” which is 0110001 which is “A” you will need to flip the following bites 01000001<span> as represented in ASCII. Since we are only looking at 2bit digit which is 0 and 1 which  has a 256 possible combinations from 0 up to 255. </span></span>


6 0
3 years ago
Other questions:
  • Earthquakes with magnitudes between 1.0 and 2.9 on the Richter scale are
    11·1 answer
  • The gaining of unauthorized access to data in a<br> system or computer:
    11·1 answer
  • The email program shipped with Microsoft office
    15·1 answer
  • How to block someone from watching your youtube videos?
    12·2 answers
  • Which of the following is an Internet supervisory protocol? O DNS IP O both A and B O neither A nor B
    12·1 answer
  • [ANSWER = BRAINLIEST] How to mark an answer as brainliest?
    13·2 answers
  • In two to three sentences, describe one advanced search strategy and how it is useful.
    13·1 answer
  • This is Very very Important to me[BRAINLIEST)✅​
    5·1 answer
  • Assignment 3: chabot<br>​
    13·1 answer
  • a. Describe how the student can use the jar of rice to model particle motion of a substance in each state of matter: solid, liqu
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!