1. A method named isPrime that takes an integer number and returns true if the integer is prime and false otherwise. The header of the method is as follows: public static boolean isPrime(int number) 2. A method named isEven that takes an integer number and returns true if the integer is even and false if it is odd. The header of the method is as follows: public static boolean isEven(int number)

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 13PE
icon
Related questions
Question

Java, solve please sir and thank you 

Part-2: In your main class write the following methods:
1. A method named isPrime that takes an integer number and returns true if the integer is
prime and false otherwise.
The header of the method is as follows:
public static boolean isPrime(int number)
2. A method named isEven that takes an integer number and returns true if the integer is
even and false if it is odd.
The header of the method is as follows:
public static boolean isEven(int number)
3. A method named getFactors that takes an integer number and returns a String that
contains all factors of the integer, starting with 1 and ending with the integer itself, space
separated.
The header of the method is as follows:
public static String getFactors(int number)
For example, if the number 20 is passed to the method, it must return the String: "1 24
5 10 20"
4. A method named printIntegerInfo that takes an integer number, and prints information
about the integer to the console as follows:
Integer is
Value of integer must be printed in
Even/Odd
Invoke the isEven method to determine if the integer is Even or Odd.
Invoke the isPrime method to determine if the integer is prime or composite.
Invoke the getFactors method to get the factors of the integer.
Prime/Composite
Factors:
The header of the method is as follows:
public static void printIntegerInfo(int number)
5. In your main method, read an integer from the user then invoke the printIntegerInfo to
print information about the entered integer.
Transcribed Image Text:Part-2: In your main class write the following methods: 1. A method named isPrime that takes an integer number and returns true if the integer is prime and false otherwise. The header of the method is as follows: public static boolean isPrime(int number) 2. A method named isEven that takes an integer number and returns true if the integer is even and false if it is odd. The header of the method is as follows: public static boolean isEven(int number) 3. A method named getFactors that takes an integer number and returns a String that contains all factors of the integer, starting with 1 and ending with the integer itself, space separated. The header of the method is as follows: public static String getFactors(int number) For example, if the number 20 is passed to the method, it must return the String: "1 24 5 10 20" 4. A method named printIntegerInfo that takes an integer number, and prints information about the integer to the console as follows: Integer is Value of integer must be printed in Even/Odd Invoke the isEven method to determine if the integer is Even or Odd. Invoke the isPrime method to determine if the integer is prime or composite. Invoke the getFactors method to get the factors of the integer. Prime/Composite Factors: The header of the method is as follows: public static void printIntegerInfo(int number) 5. In your main method, read an integer from the user then invoke the printIntegerInfo to print information about the entered integer.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage