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
konstantin123 [22]
3 years ago
6

Given that a method receives three parameters a, b, c, of type double, write some code, to be included as part of the method, th

at determines whether the value of "b squared" – 4ac is negative. If negative, the code prints out the message "no real solutions" and returns from the method
Computers and Technology
2 answers:
Debora [2.8K]3 years ago
6 0

Answer and Explanation:

class Dis

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter values for a,b,c");

double a=sc.nextDouble();

double b=sc.nextDouble();

double c=sc.nextDouble();

String s=discriminant(a,b,c);

System.out.println(s);

}

public String discriminant(double a, double b, double c)

{

double result;

result=(b^2-4ac);

if(result<0)

return "no real solutions"";

else return "";

}

}

Note:This program is written in JAVA

Llana [10]3 years ago
3 0

Answer:

The solution code is written in Java:

  1.   public static boolean check_discriminant(double a, double b, double c)
  2.    {
  3.        double discriminant = b * b - (4 * a * c);
  4.        if(discriminant > 0){
  5.            return true;
  6.        }
  7.        else{
  8.            System.out.println("no real solutions");
  9.            return false;
  10.        }
  11.    }

Explanation:

Firstly, we define a function check_discriminant() that takes three parameters with double type,<em> a, b and c </em>(Line 1).

Next, we calculate the discriminant using the formula b² - 4ac (Line 3). We place the discriminant in if condition (Line 5) to see if it is a negative or positive value. If positive return true (Line 6) and if negative it will print out message "no real solutions" and return false (Line 9 -10).

You might be interested in
Complete the sentence.<br> A ___ number is composed of only zeros and ones.
Naya [18.7K]

Answer:

Binary

Explanation:

4 0
2 years ago
Your mom is trying to save room on her hard drive and wants to uninstall some of her applications. She asks you how to do this.
katen-ka-za [31]
<span>Explore and select Uninstall from the context menu. B. Right-click on the application execution file and select Delete from the context menu. C. Go to Task Manager and find the listed application, then right-click on it and select Uninstall. D. Go to Programs and Features and find the listed application. Then right-click on it and select Uninstall.

Hope this helped!</span>
6 0
3 years ago
Read 2 more answers
Write a program that reads in ten numbers and displays the number of distinct numbers and the distinct numbers separated by exac
ELEN [110]

Answer:

The program to this question can be given as:

Program:

//import package.

import java.util.*;

public class Main //defining the class

{

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

{

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

 int[] a = new int[10];//define array.  

 int number,counts= 0,i;//define variable.

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

 for (i = 0; i < 10; i++) //loop  

 {

  number=ob.nextInt();

  if (isDistinct(a,number))

  {

      a[counts] = number;//assign value in array

      counts++; // Increment count

  }

 }

 System.out.println("The distinct numbers is :" + counts);

 System.out.print("The distinct number are :");

 for (i = 0; i <a.length; i++)//loop

 {

  if (a[i] > 0)

  {

   System.out.print(" " +a[i]);//print array.    

  }

   

 }

 System.out.println();

}

public static boolean isDistinct(int[] array, int num)//defining method  

{

 for (int i = 0; i < array.length; i++)//loop for check number  

 {

  if (num == array[i]) //check condition

  {

      return false; //return value false.

  }

 }

 return true; //return value true

}

}

Output:

First time run:  

Enter ten numbers: 1 2 3 4 5 6 7 8 9 10

The number of distinct numbers is 10

The distinct numbers are 1 2 3 4 5 6 7 8 9 10

Second time run:

Enter numbers: 2 3 5 8 7 4 3 2 1 2

The distinct numbers is :7

The distinct number are : 2 3 5 8 7 4 1

Explanation:

The description of the above java code can be given as:

  • In the above java code, a class is defined that is main inside a class-main function is defined in the main function firstly creating a scanner class object that is "ob" then define variables and array that are number, counts and a[].
  • To inserts array elements we use a loop. In the loop, we use integer variable number and define a condition in if block passes a function that check value count total value.
  • In the second loop, we check the condition that array elements value is greater than 0 and print all array elements.
  • The isDistinct function checks in the array two values are not the same. if the values are the same it will return false value because this function is the boolean type that returns an only boolean value.
6 0
3 years ago
the front desk of the Nocete's Hotel will comlute the total room sales (TRS) of Room 101.The room was occupied three times and t
Rus_ich [418]

Answer:

Php. 1050

Explanation:

Total Room sales for Room 101:

Rate = 350

Number of times occupied = 3

Total sales per room : (number of times room was occupied * rate of the room.)

Hence, total sales for room 101:

Php. 350 * 3

= Php. 1050

4 0
2 years ago
Which of the following do nylon and Kevlar fibers have in common?
asambeis [7]

Answer:

Kevlar. Kevlar is similar in structure to nylon-6,6 except that instead of the amide links joining chains of carbon atoms together, they join benzene rings. The two monomers are benzene-1,4-dicarboxylic acid and 1,4-diaminobenzene.

Explanation:

3 0
2 years ago
Other questions:
  • To display the control panel window, first right-click ____ and then click control panel.
    5·1 answer
  • Which information is necessary to determine an object's speed?
    13·1 answer
  • Cyberlaw consists of: a. only state statutes. b. only federal statutes. c. traditional legal principles that have changed becaus
    6·1 answer
  • PLZZZ HELP 30 POINTS!!
    14·1 answer
  • . The toasting cycle of an automatic toaster is started by A. pushing the bread rack down. B. pushing the start button. C. turni
    14·2 answers
  • ________ is a remote access client/server protocol that provides authentication and authorization capabilities to users who are
    10·1 answer
  • An organization is trying to decide which type of access control is most appropriate for the network. The current access control
    12·1 answer
  • What is the purpose of a Post Mortem Review? (5 points)
    5·1 answer
  • DERECTIONS: Identify all the computer software that you need for the following entrepreneurial activities. Refer your answer fro
    5·1 answer
  • A type of attack where the adversary intercepts network packets, modifies them, and inserts them back into the network is called
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!