CS1301 Lab 9
CS 1301 Lab 9
100 Points
Attendance is worth 10 points.
(90 points) Team Problem 1:
For this program you need to submit the source code
(.java), including prolog.
Design a class named QuadraticEquation for a quadratic equation ax*x + b*x + x = 0. The class
contains:
- Private data fields a, b, and c that represent the three coefficients
- A constructor with three parameters that initialize a, b, and c
- Three accessor (getter) methods for a, b and c
- A method named getDiscriminant() that returns the discriminant, which is b*b - 4*a*c.
- The methods named getRoot1() and getRoot2() for returning two roots of the equation: r1 = (-b + Math.sqrt(b*b - 4*a*c))/(2*a) and r2=(-b - Math.sqrt(b*b - 4*a*c))/(2*a). These methods
are useful only if the disciminant is positive. If the discriminant is negative, these methods should return 0.
Write a test program that prompts the user for the values a, b and c and displays the result based on the discriminant.
To successfully complete this lab you should:
- (90+10 points) Submitted the team problem solution before the day ends, Thursday November 13th.