pls use C++ to answer pls use C++ to answer pls use C++ to answer pls use C++ to answer

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

pls use C++ to answer pls use C++ to answer pls use C++ to answer pls use C++ to answer

Post by answerhappygod »

pls use C++ to answer pls use C++ to answer pls useC++ to answer pls use C++ to answer
Pls Use C To Answer Pls Use C To Answer Pls Use C To Answer Pls Use C To Answer 1
Pls Use C To Answer Pls Use C To Answer Pls Use C To Answer Pls Use C To Answer 1 (109.62 KiB) Viewed 29 times
Question B4 The program below solves the quadratic equation ax² + bx + c = 0. Given that a is non-zero, implement a class Quadratic such that the sample output is produced. The class contains the following members: - Three double type private data members (a, b, c) storing the values of the constants. - A constructor with three parameters that assigns the argument values to the data members. A private member function delta() that returns the value of delta, where delta = b² - 4ac. A public member function showRoot() that, by calling the function delta() appropriately, displays the root(s) of the equation. The roots can be calculated as follows: -b ± √b² - 4ac roots = 2a Note that there may be no root (delta < 0), 1 root (delta is 0) or 2 distinct roots (delta > 0). You may use this C++ function to calculate square root: double sqrt (double); #include #include using namespace std; // Your codes for B4 should be inserted here int main() { } Quadratic fl (1, 2, 3); Quadratic £2 (2, -4, 2); Quadratic f3 (1.1, 3.3, 2.2); cout << "f1 has "; fl.showRoot (); cout << "\nf2 has "; f2.showRoot (); cout << "\nf3 has "; £3.showRoot (); return 0; Sample Output: fl has No root f2 has 1 root: 1 f3 has 2 roots: -1 and -2 (10 marks) // x^2 + 2x + 3 = 0 // 2x^2 // 1.1x^2 +3.3x + 2.2 = 0 4x + 2 = 0
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply