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
12. What are the additional elements required of a network architecture if the enclave is to support remote access through the p
Romashka [77]

The additional elements needed of a network architecture are:

  • Policy management
  • Remote access server
  • VPN Gateway, etc.

<h3>What is network architecture example?</h3>

Network architecture is known to be the set up of a computer network. It is regarded as the backbone for the specification of the physical attributes of a network and also their functional configuration.

An examples is a printer that is linked to the network. Note that  additional elements required of a network architecture if the enclave is to support remote access through the public Internet are Policy management, etc.

Learn more about network architecture from

brainly.com/question/13986781

6 0
2 years ago
Type the correct answer in the box. Spell all words correctly. What type of network is the Internet? The Internet is an example
denis23 [38]

Answer:

The answer is WAN (Wide Area Network).

Explanation:

  • The Internet is an example of WAN. It stands for wide area network. It is an information network that commonly links to computers that cover a broad specific area. In a WAN, two towns, states, or countries are linked.  
  • The main purpose of using WAN includes a wide range, offers unified information, get upgraded files and software, several email sharing applications, etc.
6 0
3 years ago
Write a program that calculates and displays the amount ofmoney available in a bank account that initially has $8000 deposited i
Leviafan [203]

Answer:

Written in Python

import math

principal = 8000

rate = 0.025

for i in range(1, 11):

    amount = principal + principal * rate

    principal = amount

    print("Year "+str(i)+": "+str(round(amount,2)))

Explanation:

This line imports math library

import math

This line initializes principal amount to 8000

principal = 8000

This line initializes rate to 0.025

rate = 0.025

The following is an iteration from year 1 to 10

for i in range(1, 11):

    This calculates the amount at the end of the year

    amount = principal + principal * rate

    This calculates the amount at the beginning of the next year

    principal = amount

    This prints the calculated amount

    print("Year "+str(i)+": "+str(round(amount,2)))

6 0
3 years ago
The insertion sort algorithm sorts using what technique?
QveST [7]

Answer:

Iteration

Explanation:

The insertion sort is based on repetition of comparing one data array (or element in a list) with the others at its left to reorganize it, normally following a size criteria (from small to big or the other way around).

At each iteration, the algorithm takes one element and compares it one by one to the others until it fit the specified criteria. Later on, it creates a space, moving the other elements, to insert it. Later, it  goes to the next element and the iteration repeats all the way through. It has some advantages over other sorting algorithms because it is easy to deploy and program it in many different languages, but at the same time it can be terribly slow when sorting large amount of data.

7 0
2 years ago
What types of files we do backup in UNIX and Linux?
katrin [286]

Answer:

Nas ja kaki yawe diy. Kitu mu chuk k a jana a.

Explanation:

Karu explain pudi diya chal puter chuti kar.

8 0
2 years ago
Read 2 more answers
Other questions:
  • What is a stereo type?
    14·2 answers
  • A .jpg file is an example of which of the following file types
    15·2 answers
  • The negotiators past relationship will affect current behavior if the parties
    12·1 answer
  • Electronic transmission of information standards, such as transaction and code sets and uniform identifiers, are covered underQu
    8·1 answer
  • A user contacted the help desk to report that the laser printer in his department is wrinkling the paper when printed. The user
    5·1 answer
  • What is data analysing data and give three examples ?​
    9·1 answer
  • Compile and Execute a Program
    13·1 answer
  • Interstate highway numbers Primary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 of 95) go north/south, an
    8·1 answer
  • Look at the following partial class definition, and then respond to the questions that follow it:
    12·1 answer
  • What does a companys code of ethics cover
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!