Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code im java please!!! Problem 21 Define the class Quadratic that has the following data fields and methods. Data fields: Instance data fields: a, b,

code im java please!!! image text in transcribed
Problem 21 Define the class Quadratic that has the following data fields and methods. Data fields: Instance data fields: a, b, and c of type double. These variables store the coefficients of a quadratic equation of the form a *x*x+bx+c. Methods: An empty no-arg constructor. A constructor that takes three arguments, sets the instance data fields to the taken arguments. Quadratic(double aVal, double bVal, double eVal) } o A void method named setA that sets the value of the instance data field a to the value provided as an argument. A void method named set that sets the value of the instance data field b to the value provided as an argument. o A void method named set that sets the value of the instance data field c to the value provided as an argument void setC(double Value) A method that checks whether the equation has two real roots. If Vb2 - 4ac 20, the equation has two real roots and the method returns truc, otherwise it returns false. boolean hasRealRoots() { } A method that evaluates the equation at a given point x. The method returns the result of evaluating this equation at a given point x (a****+ bx + c), with x given as an argument. For example, if a -2, b = 1, and c = 1 and x = 3, the method returns 20 (2*3*3 + 1*3 -1 -20). double evaluateQuadratic(double x){ } Extra credit: 10%. A method that returns an array of size 2 that contains the real roots of this quadratic equation. The two roots of the equation are given as follows -4ae Vac 20 double[getRoots() { A method that displays this object in a format of your choice. void printQuadratico Create a test class named TestQuadratic to test the class Quadratic and sketch the UML class model of the Quadratic class. The UML should be submitted either as an image or a word file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions