Question
A composite number is defined to be the one that is positive integer and has at least one divisor other than 1 and itself. Negative
A composite number is defined to be the one that is positive integer and has at least one divisor other than 1 and itself. Negative numbers are not composite by definition. A composite number can be formed by multiplying two smaller positive integers. Write a method named isComposite that returns true if its integer argument is composite, otherwise it returns false. use the method signature:
Code start with boolean:
/**
* This method returns true if its integer argument is composite, otherwise it returns false
* A number is defined to be the one that is positive integer and has at least one divisor other than 1 and itself.
* For example, 4 and 6 are composite whereas 3 and 5 are not.
*/
public static boolean isComposite(int input) {
// DELETE THE LINE BELOW ONCE YOU IMPLEMENT THE CALL!
throw new RuntimeException("not implemented!");
}
input return false false false false true (because 2 is a divisor) false true (3 is a divisor) false true (2,4 are divisors) true (3 is a divisor) true (2,5 are divisors) false true (2,3,4,6 are divisors) 13 false -14 false 15 true (3,5 are are divisors)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started