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
Which of the following electronic payments is ideal for micropayments?
timama [110]

Answer:

B. smart cards

Explanation:

3 0
3 years ago
Read 2 more answers
What did the Lorax mean when he said i speak for the trees
kirill [66]

Answer:

The trees have no tongues, And the Lorax disapproves of the use of the Tree and the Thneed.

3 0
3 years ago
You can be sentenced to up to 180 days in jail for driving with a license that was suspended for _________ .
Yanka [14]

Answer:c\

Explanation:

4 0
3 years ago
A new computer workstation has been installed in a small office. the user of the workstation can print a document using a networ
ICE Princess25 [194]
The printer is setup as a local printer therefore it does not need access to internet to access the local network printer. Once the new workstation is given access to the terminal server used for the printer, it will not need to connect on the internet to print. Now, if the workstation is not able to access the internet it could be potentially due to incorrect configuration of DNS to the workstation or actual issue is within the ISP.
3 0
3 years ago
Which technology concept uses computer resources from multiple locations to solve a common problem?​
umka2103 [35]

Answer:

Distributed memory systems

Distributed memory systems use multiple computers to solve a common problem, with computation distributed among the connected computers (nodes) and using message-passing to communicate between the nodes.

Explanation:

5 0
3 years ago
Other questions:
  • 15. The text of a desktop publishing document is often created using
    6·2 answers
  • Please help me complete this task for ICT! Its about Hardware and Software
    12·1 answer
  • Discuss trends in cellular data transmission speeds
    15·2 answers
  • Someone asks you for help with a computer that hangs at odd times. You turn it on and work for about 15 minutes, and then the co
    10·1 answer
  • which of the following cells can't be recarged? A. Electrode cell B. wet cell C. primary cell D. storage cell
    13·1 answer
  • Ujqwgydft frrhyy4e uvbw vhrwbhv vbyrewblv?
    14·1 answer
  • Fill in the blank with the correct term.
    10·2 answers
  • Launa is reviewing several videos from her friends doing the latest dance challenge before they are published on their own
    11·1 answer
  • The term Linux Intrusion Detection System ( LIDS) refers to a command that allows an administrator to run processes as root with
    5·1 answer
  • A slide titled Alexander Graham Bell. There are 6 bulleted entries on the slide, and there is a lot of text on the slide. There
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!