Multiple Functions
Due: 2/4/02 at 1:00 pm
Write a Java application that provides the following capabilities:
The completed assignment should be sent to [email protected]
Specific Requirements:
1) Prompt for user input of an integer.
2) State whether input integer is prime.
Example Execution
Integer prime determination:
Please enter an integer> 36
36 is not prime.
Would you like to determine if another integer
is prime (1- Yes, 2 -No)> 2
ax
2 + b
x + c = 0,
where a, b and c are fixed coefficients and x
is a real number variable.
There are six rules for finding the roots
of a quadratic equation:
1. If a, b and c areall zero, then every value of x is a real root.
2. If a and b are zero, but c is nonzero, then there are no real roots.
3. If a is zero, and b is nonzero then the only real root is x = -c /b.
4. If a is nonzero and b2 < 4ac, then there are no realroots.
5. If a is nonzero and b2 = 4ac, then there is one real root x= -b / 2a.
6. If a is nonzero, and b2 > 4ac, then there are two realroots:
Specific Requirements:
1) GCD algorithm must be recursive.
2) Prompt users for input of 2 integers.
3) State the GCD of the 2 integers.
Example Execution
Greatest Common Divisor of 2 integers:
Please input integer A> 36
Please input integer b> 20
The greatest common divisor of 36 and 20 is 4.
Would you like to compute another GCD (1- Yes, 2 -No)> 2