A community for students.
Here's the question you clicked on:
 0 viewing
bunyonb
 2 years ago
I cannot wrap my head around this C++ question:
1. Write a program that finds the solutions, if any, to a given quadratic equation. A quadratic equation is any equation written in the form ax^2 + bx+ c. Keep in mind division by 0 is not permitted and the discriminant b^24ac cannot be negative. Use the quadratic formula. Note: if you feel for some reason you do not want to give me the C++ code then you can give me in pseudocode.
bunyonb
 2 years ago
I cannot wrap my head around this C++ question: 1. Write a program that finds the solutions, if any, to a given quadratic equation. A quadratic equation is any equation written in the form ax^2 + bx+ c. Keep in mind division by 0 is not permitted and the discriminant b^24ac cannot be negative. Use the quadratic formula. Note: if you feel for some reason you do not want to give me the C++ code then you can give me in pseudocode.

This Question is Closed

fpmaker
 2 years ago
Best ResponseYou've already chosen the best response.1This is literally exactly the code you need...just in java...not hard to figure out what it should be in c++  change the system.outs to cout<<....etc...but this should help you out a lot! public static void main(String[] args) { System.out.print("This program solves a quadratic equation.\nEnter the coefficients a b c: "); //get the three variables from user Scanner reader= new Scanner (System.in); double a=reader.nextDouble(); double b=reader.nextDouble(); double c=reader.nextDouble(); //calculate discriminate to determine how many solutions and calculate them double disc=((b*b)(4*a*c)); double quadP= (b+Math.sqrt(disc))/(2*a)+0; double quadM= (bMath.sqrt(disc))/(2*a)+0; //equation with user's variables System.out.format("Equation: %.2f*x^2 + %.2f*x + %.2f = 0\n", a, b, c); if (a==0.0 && b==0 && c==0) { System.out.println("All real numbers are solutions."); } else if (a==0 && b==0) { System.out.println("There are no real solutions."); } else if (a==0) { double x= ((c)/(b))+0; System.out.format("There is one real solution: %.2f.\n", x); } else { if (disc<0.00) { System.out.println("There are no real solutions."); } else { if (disc>0.00) { System.out.format("There are two real solutions: %.2f, %.2f.%n", quadM, quadP); } if (disc==0.00) { System.out.format("There is one real solution: %.2f.%n", quadP); } {
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.