Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

image text in transcribed

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

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

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

design a simple disciplinary and grievance procedure.

Answered: 1 week ago