Java Reference
In-Depth Information
Enter a decimal number: -0.45452
The fraction number is -11363/25000
13.20
(
Algebra: solve quadratic equations
) Rewrite Programming Exercise 3.1 to obtain
imaginary roots if the determinant is less than 0 using the
Complex
class in
Programming Exercise 13.17. Here are some sample runs.
Enter a, b, c: 1 3 1
The roots are -0.381966 and -2.61803
Enter a, b, c: 1 2 1
The root is -1
Enter a, b, c: 1 2 3
The roots are -1.0 + 1.4142i and -1.0 + -1.4142i
13.21
(
Algebra: vertex form equations
) The equation of a parabola can be expressed
in either standard form (
y
ax
2
h
)
2
k
).
Write a program that prompts the user to enter
a
,
b
, and
c
as integers in standard
form and displays
h
and
k
in the vertex form. Here are some sample runs.
=
+
bx
+
c
) or vertex form (
y
=
a
(
x
-
+
Enter a, b, c: 1 3 1
h is -3/2 k is -5/4
Enter a, b, c: 2 3 4
h is -3/4 k is 23/8
Search WWH ::
Custom Search