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
A combined counting and logical looping statement may be needed in the following situations: (a). The values stored in a linked
sergejj [24]

Answer:

a i think

Explanation:

5 0
2 years ago
The ticketing system at the airport is broken, and passengers have lined up to board the plane in the incorrect order. This line
wolverine [178]

Answer:

See explaination

Explanation:

The program code

import java.util.ArrayList;

public class Main

{

public static void main(String[] args)

{

ArrayList<AirlineTicket> tickets = new ArrayList<AirlineTicket>();

//This creates a randomized list of passengers

addPassengers(tickets);

for(AirlineTicket elem: tickets)

{

System.out.println(elem);

}

//This creates a TicketOrganizer object

TicketOrganizer ticketOrganizer = new TicketOrganizer(tickets);

//These are the methods of the ticketOrganizer in action

System.out.println("\nPassengers Ordered by Boarding Group:");

ticketOrganizer.printPassengersByBoardingGroup();

System.out.println("\nPassengers in line who can board together:");

ticketOrganizer.canBoardTogether();

}

//Do not touch this method! It is adding random passengers to the AirlineTicket array

public static void addPassengers(ArrayList<AirlineTicket> tickets)

{

String[] seats = {"A","B","C","D","E","F"};

for(int index = 0; index< 15; index++)

{

int random = (int)(Math.random() * 5);

AirlineTicket ticket = new AirlineTicket("Passenger " + (index+1), seats[random], ((int)(Math.random()*5)+1), ((int)(Math.random()*8)+1));

tickets.add(ticket);

}

}

}

class TicketOrganizer

{

private ArrayList<AirlineTicket> tickets ;

//constructor with parameter as an arraylist of AirlineTicket

public TicketOrganizer(ArrayList<AirlineTicket> tickets)

{

this.tickets = tickets;

}

//methhods to return the arraylist of airlines

public ArrayList<AirlineTicket> getTickets()

{ //re-organize the ticket first

ArrayList<AirlineTicket> tickets_organized = new ArrayList<AirlineTicket>();

for(int i=1; i<=5; i++)

{

for(AirlineTicket ticket: tickets)

{

if(ticket.getBoardingGroup() == i)

{

tickets_organized.add(ticket);

}

}

}

return tickets_organized;

}

//print the tickets based on boardingGroup

public void printPassengersByBoardingGroup()

{

int count = 0;

for(int i=1; i<=5; i++)

{

System.out.println("Boarding Group " + i + ":");

for(AirlineTicket ticket : tickets)

{

if(ticket.getBoardingGroup() == i)

{

System.out.println("Passenger " + ticket.getName());

}

}

}

See attachment for sample output

4 0
4 years ago
An air purifier manufacturer is looking for ideas on using edge computing to enhance its products and services. Which approach w
Mariana [72]

We have that  an air purifier manufacturer can apply  edge computing technologies is inventory management.

<h3> Air purifier manufacturer and  edge computing</h3>

Question Parameters:

Generally,Edge computing is computing and storing resources at the data  production area.

Hence, An air purifier manufacturer can apply  edge computing technologies is inventory management as it will aid incoming and outgoing inventory assessment on production grounds.

For more information on Technology

brainly.com/question/25274620

5 0
2 years ago
Read 2 more answers
You can use view the ______ file to view the hard drive details.
Anastaziya [24]

Answer:

/proc/partitions

5 0
2 years ago
who likes tom holland as spiderman and his web shooter tippets when he swings off buildings in new york city midtown, Forest Hil
S_A_V [24]

Answer:

YESSSS!!!!

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Amy has decided to use a dark background and light colored text for her prensentation. Which toolbar option will let her change
    5·1 answer
  • A toolkit is:
    15·1 answer
  • The Maui coffee shop sells coffee at $10.50 a pound plus the cost of shipping. Each order ships for $0.86 per pound + $1.50 fixe
    14·1 answer
  • The rules of thumb designers use when creating a wireframe page
    8·1 answer
  • A small graphic that you click on to perform a function in a software program is called a _____.
    15·1 answer
  • Which of the following are examples of structured data?
    15·1 answer
  • You cannot legally install macOS on a PC that originally came with Windows<br> True or false
    13·2 answers
  • Which footing supports a long brick or concrete wall<br>​
    14·1 answer
  • Please help me with my question ​
    15·2 answers
  • Some operating systems add the command interpreter to the kernel .what will be the justification for this design principle?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!