Title | Public class Math Toolbox |
---|---|
Course | Lab For Lecture 001 |
Institution | George Mason University |
Pages | 7 |
File Size | 47.3 KB |
File Type | |
Total Downloads | 41 |
Total Views | 141 |
Solution to Mandatory Project 1...
public class MathToolbox {
/** This method should return true if and only if the input i is a positive * prime number. A prime is a number which is only divisible by 1 and * itself (however the numbers 0 and 1 are not considered primes). */ public static boolean isPrime(int i) {
// assume it's prime, then look for cases which prove otherwise boolean prime = true;
// not prime if it's smaller than 2 if (i...