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
The term used to describe the shape and layout of a computer component such as a motherboard or hard drive is __ factor?
Flauer [41]
FORM factor. Example are ATX, micro ATX, and many more. ATX and MATX are the most common next to servers as well
3 0
2 years ago
Sam works in a real estate office. An offer comes in on a house but the homeowners are on vacation. He needs the homeowners to s
Digiron [165]

Answer:

Sam should send a digital document and request a signature. The could be fax or even an image printed out, if neither is possible get in contact with eh owner and his lawyer for more help.

Explanation:

3 0
3 years ago
Which of the following is not a valid SQL command? (Points : 2) UPDATE acctmanager SET amedate = SYSDATE WHERE amid = 'J500';
Volgvan

Answer:

UPDATE acctmanager WHERE amid = 'J500';

Explanation:

The statement written above is not valid SQL statement because there is no SET after UPDATE. Update is always used with SET.If you are updating something then you need to specify the value with which that value should be replaced.

UPDATE acctmanager SET amname = UPPER(amname);

This statement does not contains WHERE clause but it will run all the values of amname column will get updated in the table acctmanager.

6 0
2 years ago
Insecurely attached infants who are left my their mothers in an unfamiliar setting often will
Temka [501]

Insecurely attached infants who are left my their mothers in an unfamiliar setting often will Hold fast in their mothers in their return.

A. Hold fast in their mothers in their return

<u>Explanation:</u>

It is in the conscience of the infants to have the company of their parents no matter the place or time and do not generally like to be left alone. Moreover, the questions says, insecurely attached infants which further add up to this behavior.

The infant would not explore the surroundings due to lack of confidence in an unfamiliar setting. They would rather be uncomfortable and most probably weep the time until their mother arrives and hold fast on to them on their return.  

8 0
3 years ago
A self improvement plan should begin with planning how you will accomplish your goal.
Artist 52 [7]

Answer:

True

Explanation: The first step is to make a goal. The second step is to plan how you will accomplish you goal. The third and final step is to accomplish your goal.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Lossless and lossy are the two (2) universally known categories of compression algorithms. Compare the two (2) categories of alg
    8·2 answers
  • What exactly does the value recorded in a single dimension of a sift keypoint descriptor signify?
    15·1 answer
  • CNG and gasoline-powered vehicles use the same internal combustion engine, but different fuel types. A) True B) False
    8·2 answers
  • Which of the following are points that can demonstrate the accuracy of a website?
    6·1 answer
  • You should structure the<br> first before you search for a relevant picture.
    11·1 answer
  • ____ is the code of acceptable behaviors users should follow while on the internet; that is, it is the conduct expected of indiv
    10·1 answer
  • Hey yall! Its spoopy season! I am having a live stream on the Spoon app under the username teendragonqueen️‍ if yall wanna join!
    11·2 answers
  • 3.17 (LAB) Ch 5 Warm up: Drawing a right triangle (Python 3) This program will output a right triangle based on user specified h
    10·1 answer
  • What is a cloud in the world of computing
    7·1 answer
  • What common variation of the Server Message Block (SMB) sharing protocol is considered to be a dialect of SMB?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!