Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE IN VISUAL STUDIO Program 1: Design (pseudocode) and implement (source code) a class (name

PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE IN VISUAL STUDIO Program 1: Design (pseudocode) and implement (source code) a class (name it QuadraticEquation) that represents a quadratic equation of the form of ax2+ bx + x = 0. The class defines the following variables and methods: 1. Private data field a, b, and c that represent three coefficients. 2. A constructor for the arguments for a, b, and c. 3. Three get methods for a, b, and c. 4. Method getDiscriminant()returns the discriminant value, which is disc = b2 4ac. 5. Method getRoot1() returns first root if the discriminant is not negative. First root is defined as R1 = (-b + SquareRoot (disc) ) / 2a 6. Method getRoot2() returns second root if the discriminant is not negative. Second root is defined as R2 = (-b - SquareRoot (disc) ) / 2a Note that if the discriminant values is negative, the roots are Undefined. Write a test program (name it testEquation) to create objects and test the class methods. Organized your output following these sample runs. Sample run 1 for 3x2+ 8x + 4: a = 3 b = 8 c = 4 Root 1 = -0.6666666666666666 Root 2 = -2.0 Sample run 2 for 3x2+ 4x + 8: a = 3 b = 4 c = 8 Root 1 is Undefined Root 2 is Undefined Sample run 3 for 2x2+ 8x + 2: a = 2 b = 8 c = 2 Root 1 = -0.2679491924311228 Root 2 = -3.732050807568877

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

Step: 3

blur-text-image

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

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions