Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Chapter 8 lab: Design a class called QuadraticEquation for a quadratic equation Chapter 8 lab 1. Design a class called QuadraticEquation for a quadratic equation
Chapter 8 lab: Design a class called QuadraticEquation for a quadratic equation
Chapter 8 lab 1. Design a class called QuadraticEquation for a quadratic equation Here is the UML for the class QuadraticEquation -double a double b +QuadraticEquation(double a, double b, double c) +getA): double tgetB(): double +setA(double a): void +setB(double b): void +setC(double c):void getDiscriminant(): double// returns the discriminant, returns zero if it is negative +getRoot10: double//return zero if the discriminant is negative +getRoot20: double//return zero if the discriminant is negative. +equals(QuadraticEquation e):boolean tgetEquation): String. This method needs to return the equation in the form of: example: 3x2 +toStringl: Stri 4x 7 0 2. 3. Create a text file using notepad to include the coefficients a, b, and c for 10 different equations Create a driver class to do the following: a. Declare an array of QuadraticEquation with the size 10 b. Create a method called fillArray(QuadraticEquation equations). This method reads the info for each equation from a file, then creates an object of QuadraticEquation, then stores it in the array Write the method called getresult(QuadraticEquation equations) that for(int i =0 ; K equations. length, i++) c. i. Calls the method getEquation to display the equation for each object in the array ii. Call the method getDiscriminant for each equation in the array ii. Call the method getRoot1 for each equation in the array iv. Call the method getRoot2 for each equation in the array v. Display the result for each object in the array
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started