Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the following method, called numberInfo, that takes an integer parameter called input, and returns a String depending on the value of input. If input

Complete the following method, called numberInfo, that takes an integer parameter called input, and returns a String depending on the value of input.

If input is positive, numberInfo will return the String "positive".

If input is zero, numberInfo will return the String "zero".

If input is negative and odd, numberInfo will return the String "odd".

If input is negative and even and divisible by five, numberInfo will return the String "magic"

If input is negative and even but not divisible by five, numberInfo will return the String "even"

Examples:

System.out.print(numberInfo(2));

prints "positive"

System.out.print(numberInfo(3));

prints "positive"

System.out.print(numberInfo(0));

prints "zero"

System.out.print(numberInfo(-9));

prints "odd"

System.out.print(numberInfo(-10));

prints "multi"

System.out.print(numberInfo(-14));

prints "even"

public static String numberInfo(int input) {

//write the method body code in the box below

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

What is polarization? Describe it with examples.

Answered: 1 week ago