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]
3 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]3 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
What does a student use when types text into a word processing program ?
kozerog [31]

Answer:

Computer Software

Explanation:

Computer software; s a set of instructions that tells a computer what to do or how to perform a task.

6 0
3 years ago
Select the correct answer from each drop-down menu.
Mashcka [7]

Answer:

plz gie brainlest and anser is down there and ghost should of never been beytread

Explanation:

image editores and  adobe  photo  shop

6 0
3 years ago
Which of the following protocols is used by an email client to retrieve messages from an email server, giving users the option t
Alexxandr [17]

IMAP  protocols is used by an email client to retrieve messages from an email server, giving users the option to keep mail messages on the server.

<h3>What is IMAP on one's email account?</h3>

IMAP is a term that connote Internet Message Access Protocol. IMAP helps one to be able to access the same inbox from a lot of devices.

Hence, IMAP  protocols is used by an email client to retrieve messages from an email server, giving users the option to keep mail messages on the server.

Learn more about email server from

brainly.com/question/15710969

#SPJ1

5 0
3 years ago
Which osi layer is responsible for combining bits into bytes and bytes into frames?
Nastasia [14]
If you are breaking the computer down try in software it does change after a while
3 0
3 years ago
What are titles that i should talk about in my ppt about history of computer science???????
chubhunter [2.5K]

Talk about who created it when it was created and the begging of it. Talk about how it established over the years. Then talk about the achivements like the first computer.

4 0
3 years ago
Other questions:
  • 1. (8 pts) Write an application that is including a three-question multiple choice quiz about Java programming language. Each qu
    8·1 answer
  • Which statement about word processing software is true?
    11·1 answer
  • In 1988, Robert Morris, Jr. launched a program called the _________ that used weaknesses in e-mail programs and operating system
    5·1 answer
  • Li Chang has recently started his own business. He plans to launch his design for an application (app) for a smartphone. All of
    9·1 answer
  • Which operation on a pwc requires more than idle speed?
    8·1 answer
  • Select the correct answer.
    8·1 answer
  • The space that helps you organize your PowerPoint or Web Page is called ______.
    13·1 answer
  • Which trait can be a positive or negative?
    13·1 answer
  • Creation of network is known as…?
    12·2 answers
  • How would the grain crusher work
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!