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
Nadya [2.5K]
3 years ago
7

Write a Java program that prompts the user to enter integer values for the sides of a triangle and then displays the values and

the type of triangle they represent. If the user enters values that do not make a valid triangle, or if any values are not greater than zero, your program should display the values entered as well the following error message: The values entered do not make a valid triangle.
Computers and Technology
1 answer:
satela [25.4K]3 years ago
7 0

Answer:

import java.util.Scanner;

public class triangle {

       public static void main (String [] args) {

           int sideOne, sideTwo, sideThree;

           Scanner in = new Scanner (System.in);

           System.out.println("Enter the first side of the triangle");

           sideOne = in.nextInt();

           System.out.println("Enter the secon side of the triangle");

           sideTwo = in.nextInt();

           System.out.println("Enter the third side of the triangle");

           sideThree = in.nextInt();

           if ( sideOne<=0||sideTwo<=0|| sideThree<=0){

               System.out.println(" The Values enter are "+sideOne+ "," +sideThree+ ","+sideThree+ " These values don't make a valid triangle");

           }

           else if ((sideOne + sideTwo> sideThree) || (sideOne+sideThree > sideTwo) || (sideThree+sideTwo > sideOne))

           {

               System.out.println ("The triangle is Valid");

           }

           else {

               System.out.println(" The Values enter are "+sideOne+ "," +sideTwo+ ","+sideThree+ " These values don't make a valid triangle");

           }

       }

Explanation:

for a Triangle to be Valid one of the three sides of the triangle must greater than the other two sides.  The code above enforces this condition using an if statement in combination with the Or Operator

The following conditions where enforced

side one, side two and side three != 0

Side One + Side Three > Side Two

Side Three + Side Two> Side One

Side Two + Side One > Side Three

You might be interested in
Which product is made using bacteria?<br>O A. Maple syrup<br>O B. Cork<br>O C. Latex<br>D. Yogurt​
yarga [219]

Answer:

The answer is D

Explanation:

5 0
3 years ago
The ____ is the ranking executive on-site when the crisis or emergency arises, who is authorized to initiate the CM plan.
aleksklad [387]

The answer is the Executive-in charge

The concept of an Executive-in charge came from the military’s chain of command. A chain of command ranges from a supervisor to the top executive of the organization. When a crisis arises, it is possible that one or more of the senior top managers may not be available for consultations because of the travel-intensive positions.






7 0
3 years ago
Read 2 more answers
1. What cause cable problems? How can these problems be solved?
lukranit [14]

Explanation:

Ageing.

Wrong selection or application.

Mechanical failures.

Corrosion of sheath.

Moisture in the insulation.

Heating of cable.

Fire and lightning surges.

Electrical puncture.

This is the only thing I know that causes cable problems, sorry if it couldn't help you!

4 0
3 years ago
In what way , if any, can your social media presence affect your chances of getting a job in social media?
____ [38]

Answer:

Your social media presence can affect your chances of getting a job anywhere, not only a job on social media.

Explanation:

Whatever you do online leaves a digital footprint. If you leave a bad digital footprint, it will be left there forever. This bad footprint could affect your chances of getting a job by setting a bad impression on the employers. The same could go for any good digital footprint you leave behind.

6 0
3 years ago
An operating system is defined as hardware that converts software into a useful form for applications.
marissa [1.9K]

Hardware that transforms software into a form that is helpful for applications is referred to as an operating system. False. Hardware conversion is done by software.

<h3>What is an operating system?</h3>
  • Computer hardware and software resources are managed by an operating system (OS), which also offers common functions for software programs.
  • Operating systems that use time-sharing plan activities to make the most of the system's resources.
  • They may also contain accounting software to allocate costs for processing time, mass storage, printing, and other resources.
  • An operating system (OS) is a piece of software that controls all of the other application programs in a computer after being originally loaded by a boot program.
  • Through a specified application program interface, the application programs seek services from the operating system (API).

To learn more about operating system, refer to:

brainly.com/question/22811693

#SPJ4

4 0
2 years ago
Other questions:
  • Using the expected format, of putting key information where the reader can’t find it, is an example of?
    8·2 answers
  • You have just created a one-way incoming trust in your domain for an external domain used by a partner company to allow your dom
    11·1 answer
  • What does it mean to “declare a variable”? create a variable use a variable share a variable modify a variable
    11·2 answers
  • Engineers use science to ______ things that people use.
    13·1 answer
  • Investigar las oportunidades de empleo y el autoempleo dentro del área de la especialidad<br>​
    14·1 answer
  • What is a computer memory <br>​
    9·2 answers
  • Which of these Logic Statement's are correct for the following diagram? *
    5·1 answer
  • Can you answer this question?
    9·1 answer
  • How would you reply to an email message you've received that has multiple recipients, all of whom you would like to see your rep
    6·2 answers
  • Choose the 3 Points in good story telling
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!