1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
JulsSmile [24]
3 years ago
10

Use java to write a program that finds the real rooots of the quadratic equation ax^2+bx+c using the quadratic formula.

Computers and Technology
1 answer:
Artyom0805 [142]3 years ago
8 0

Answer:

The program to this question can be given as:

Program:

//import package.

import java.util.*;

public class quadratic           //define class.

{

public static void main(String[] args) //define main method

{

double a,b,c;          //decalre varibale.

Scanner in=new Scanner(System.in);       //creating scanner class object.

System.out.print("Enter coefficient a: ");          //print message.

a=in.nextDouble();                      //user input.

System.out.print("Enter coefficient b: ");

b=in.nextDouble();

System.out.print("Enter coefficient c: ");

c=in.nextDouble();

solve(a,b,c);                //calling function.

}

public static void solve(double a,double b,double c)      //define method.

{

double dis;  //define variable.

dis=b*b-4*a*c;

System.out.println("The roots of "+a+"x^2 + "+b+"x + "+"("+c +")" +" are:");

//conditional statement.

if(a==0)    //by definition-denominator will be 0

{

System.out.println("Error: no real roots exist");

}

else if(dis<0)         //by definition, negative discriminant means roots are imagenary

{

System.out.println("Error: no real roots exist\n");

}

else                          //get the 2 roots

{

dis=Math.sqrt(dis);

System.out.println("first root= "+(-b+dis)/(2*a)+"\nSecond root= "+(-b-dis)/(2*a));

}

}

}

Output:

Enter coefficient a: 6

Enter coefficient b: 11

Enter coefficient c: -35

The roots of  6.0x^2 + 11.0"x +(-35)  are:

first root= 1.666666666667

Second root=-3.5

Explanation:

In the above program firstly we import packages for the user input. Then we define class. In this class we define a main method and function i.e solve function. In the main method we create the scanner class object and input the value from the user and pass the value to the function and call the function. In the solve function, we use the conditional statement that checks any of the input values is not equal to 0. if any value is equal to 0 it prints error message otherwise it prints the quadratic value and its roots.

You might be interested in
adding ______around calculations indicates which calculations should be performed first before following the typical order of op
Wittaler [7]
Parentheses! Hope this helped you
5 0
3 years ago
Which of the following is NOT something you can specify in the bullets and numbering dialog box?
geniusboy [140]

type tool?? not postive


4 0
3 years ago
security investigators discovered that after attackers exploited a database server, they identified the password for the sa acco
daser333 [38]

Organization must notify the DPA and individuals

<h3>What was the typical weakness that outside attackers exploited?</h3>

One frequent flaw in network security that some attackers have learnt to take advantage of is the propensity of some web browsers, like Safari, to launch "safe" or "trusted" scripts automatically. Threat detection is the process of scrutinizing a security ecosystem from top to bottom to find any malicious behavior that could jeopardize the network. If a threat is identified, mitigating measures must be taken to effectively neutralize it before it can take advantage of any existing vulnerabilities. It's critical to often scan because security professionals and hackers frequently discover new vulnerabilities, like Log4Shell. Therefore, scanning for and identifying security vulnerabilities is the initial step in the vulnerability remedy procedure.

To learn more about outside attackers refer to

brainly.com/question/17329931

#SPJ4

3 0
1 year ago
Answer for 5,6,7 any one know plz
katrin2010 [14]

Answer:

first question option is d

second is false

third is mark

Explanation:

5-The following are generic font

  • serif
  • sans-serif
  • cursive
  • fantasy
  • monospace

6 - We can change image size using height and width. so it is false.

7 - we can highlight text using <mark> Marked text </mark>

5 0
3 years ago
What technology allows data to be stored in one place and be retrieved by many systems?
Mice21 [21]
ICloud is one of the many different tech options.
Hope I helped,
 Ms. Weasley
4 0
3 years ago
Other questions:
  • It takes an older computer twice as long to send out a company's email as it does a newer computer. Working together, it takes t
    15·1 answer
  • What important information is added to the TCP/IP transport layer header to ensure communication and connectivity with a remote
    13·1 answer
  • SQL a. has become the de facto standard database language b. can be used to define database systems c. both a. and b. d. none of
    10·1 answer
  • You have just driven to the Hewlett-Packard site in Corvallis to field-interview a programmer. You sit down in a conference room
    6·1 answer
  • Write an Enlistee class that keeps data attributes for the following pieces of information: • Enlistee name • Enlistee number Ne
    7·1 answer
  • You would like to know how many cells contain data. Which function should you use?
    11·1 answer
  • If the base-10 system stops with the<br> number 9, then why isn't it called<br> base-9?
    15·1 answer
  • Can you help me, please
    10·1 answer
  • A ____ can be used to enter, display, or edit data
    5·1 answer
  • What is the first phase of the project process?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!