Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a class that implements a quadratic equation. As we all remember from our math classes of yesteryear, a quadratic equation comes in the following

Write a class that implements a quadratic equation. As we all remember from our math classes of yesteryear, a quadratic equation comes in the following form: [-b +/- sqrt(b^2 - 4ac)] / 2a So, here's what I want to see:

A private type, which can hold values for 'a' 'b' and 'c'.

A constructor method (call it "new" if you'd like)

A method for getting the discriminant (that's the (b^2 - 4ac) part)

A method for getting the positive quadratic (the '+' side of '+/-')

A method for getting the negative quadratic (the '-' side of '+/-')

If you can't evaluate the positive or negative quadratics because the discriminant is negative (meaning you would otherwise try to evaluate the square root of a negative number), throw a user-defined exception.

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

Write the systematic name of each organic molecule

Answered: 1 week ago

Question

LO3 Define the difference between job satisfaction and engagement.

Answered: 1 week ago