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
Fantom [35]
3 years ago
10

in java how do i Write a method named isEven that accepts an int argument. The method should return true if the argument is even

, or false otherwise. Also write a program to test your method.
Computers and Technology
1 answer:
Veseljchak [2.6K]3 years ago
3 0
<h2>Answer:</h2><h2>============================================</h2>

//Class header definition

public class TestEven {

   

   //Method main to test the method isEven

   public static void main(String args[ ] ) {

       

       //Test the method isEven using numbers 5 and 6 as arguments

       System.out.println(isEven(5));

       System.out.println(isEven(6));

     

   }

   

   //Method isEven

   //Method has a return type of boolean since it returns true or false.

   //Method has an int parameter

   public static boolean isEven(int number){

       //A number is even if its modulus with 2 gives zero

      if (number % 2 == 0){

           return true;

       }

       

       //Otherwise, the number is odd

       return false;

   }

}

====================================================

<h2>Sample Output:</h2>

=========================================================

false

true

==========================================================

<h2>Explanation:</h2>

The above code has been written in Java. It contains comments explaining every part of the code. Please go through the comments in the code.

A sample output has also been provided. You can save the code as TestEven.java and run it on your machine.

You might be interested in
To add a glow effect to WordArt text, which of the following should be done?
g100num [7]
Number 2 is the correct answer
8 0
2 years ago
What is the numerical ratio that is equivalent to 19.2 dB?
mrs_skeptik [129]

Answer: 83.17

Explanation:

By definition, the dB is an adimensional unit, used to simplify calculations when numbers are either too big or too small, specially in telecommunications.

It applies specifically to power, and it is defined as follows:

P (dB) = 10 log₁₀ P₁ / P₂

Usually P₂ is a reference, for instance, if P₂ = 1 mW, dB is called as dBm (dB referred to 1 mW), but it is always adimensional.

In our question, we know that we have a numerical ratio, that is expressed in dB as 19.2 dB.

Applying the dB definition, we can write the following:

10 log₁₀ X = 19.2 ⇒ log₁₀ X = 19.2 / 10 = 1.92

Solving the logarithmic equation, we can compute X as follows:

X = 10^1.92  = 83.17

X = 83.17

4 0
2 years ago
Find the titles of courses in the Computer Science department that have 3 credits. Find the IDs of all students who were taught
Kay [80]

Answer:

Explanation:

To solve this we break down the question and write the programme in steps as shown in the attachment

Download docx
4 0
3 years ago
I have a summary to write for my robotics class but it is way too hard and i have a bery less time. If you can help me it would
Ierofanga [76]

Answer:

What is Robotics?

Robotics is the branch of technology that deal with the design, construction, operation and application of robots as well as computer system for there control, sensory feed back, and information processing. the design of given robotic system often contain principle of mechanical or electronic engineering and computer science. The word robotic was first used in 1941 by the writer Isaac Asimov.

Branches of robotics:

Artificial intelligence: The developing of an intelligence of machine and is a branch of computer science.

Nano Robotics : the field of creating machines that are at a scale of a nano meter.

Tele-presence: The study given to an illusion of being at a place without being there physically.

Robot Locomotion: The study of method that Robots used to transport them selves from place to another.

Robots have long captured the human imagination but despite many advances robots have yet to reach the potential so often envisioned in science fiction today engineers and computer scientist are still pursuing one missing ingredient high intelligence it would be nice for example: if robots possessed the intelligent needed to cope  with uncertainty, learn from experience and work as team.

Intelligent robots will be one of the engineering achievement of 21 century said Junku Yuh, how leads the robotics program in the national science foundation computers and information science and engineering directorate "we will see them more and more in our daily life".

5 0
3 years ago
Use the commands you've learned so far to draw a
Murrr4er [49]

The app you shown in the picture is that app scracth?

8 0
3 years ago
Other questions:
  • In this scenario, two friends are eating dinner at a restaurant. The bill comes in the amount of 47.28 dollars. The friends deci
    7·2 answers
  • Using the flowchart diagram, identifythe decision point of this solution?
    6·1 answer
  • You can encrypt individual files, but microsoft recommends encrypting at what level?
    9·1 answer
  • Read the PIC Data sheet Chapter 2.0 and 3.0 2. List at least 3 big differences between the Flash and RAM 3. How many RAM locatio
    5·1 answer
  • You and your friend who lives far away want to fairly and randomly select which of the two of you will travel to the other’s hom
    6·1 answer
  • Write a program that prompts the user to enter a point (x, y) and checks whether the point is within the rectangle centered at (
    12·1 answer
  • - What are the different types of clients?
    12·1 answer
  • Write pseudocode for the question below:
    15·1 answer
  • Computer are most wonderful creation of 21st century how ?​
    15·1 answer
  • How does Accenture help companies harness the power of data to achieve optimal business outcomes?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!