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
A technician is configuring a new SOHO multifunction wireless router at a customer's location to provide network access to sever
Alja [10]

Answer:

B. Change the router's default administrative password.

Explanation:

Whenever a user purchase a router for wireless network, a default password has been set for the device, which can be easily accessible to different users on the internet or that particular network. This will  lead to unsecured that particular user in terms of hacking or stealing data or personnel information easily.

To make sure the security of customer on private network, the technician should change the router default password.  

7 0
3 years ago
Mario is giving an informative presentation about methods for analyzing big datasets. He starts with the very basics, like what
Natasha2012 [34]

Answer:

Audience knowledge level

Explanation:

The Key issue that Mario failed to consider when preparing for her presentation is known as Audience knowledge level.  

Because Audience knowledge level comprises educating your audience with extensive information about the topic been presented. she actually tried in doing this but she was educating/presenting to the wrong audience ( People who are more knowledgeable than her on the topic ). she should have considered presenting a topic slightly different in order to motivate the audience.

3 0
3 years ago
Consider the two computers A and B with the clock cycle times 100 ps and 150 ps respectively for some program. The number of cyc
Kipish [7]

Answer:

Option d) B is 1.33 times faster than A

Given:

Clock time, t_{A} = 100 ps

t_{A} = 150 ps

No. of cycles per instructions,  n_{A} = 2.0

n_{B} = 1.0

Solution:

Let I be the no. of instructions for the program.

CPU clock cycle, f_{A} = 2.0 I

CPU clock cycle, f_{B} = 1.0 I

Now,

CPU time for each can be calculated as:

CPU time, T = CPU clock cycle\times clock time

T_{A} = f_{A}\times t_{A} = 2.0 I\times 100 = 200 I ps

T_{B} = f_{B}\times t_{B} = 1.0 I\times 100 = 150 I ps

Thus B is faster than A

Now,

\frac{Performance of A}{Performance of B} = \frac{T_{A}}{T_{B}}

\frac{Performance of A}{Performance of B} = \frac{200}{150}

Performance of B is 1.33 times that of A

7 0
3 years ago
Read 2 more answers
The set of rules for how computers talk to one another
andrezito [222]
That is program ............
4 0
3 years ago
What is the function of the kernel of an operating system? It is an application that allows the initial configuration of a Cisco
Phoenix [80]

Answer:The kernel provisions hardware resources to meet software requirements.

Explanation: Kernel is the program which behaves as the central component of the operating system.The main purpose of the kernel is to control the operation of the system to manage it.

Monolithic kernel and micro-kernel are two types of kernel units present in the computer system where they work for fulfilling the software requirement by attaching it to the hardware parts.

Other option are incorrect because it does not work for Cisco device, does not perform any specific feature only , no linkage is created between the hardware and the electronics nor reacts as navigation bar.

3 0
3 years ago
Other questions:
  • If there is no index.html file in the root folder nothing will be displayed when you navigate to the site address
    14·1 answer
  • Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
    7·1 answer
  • Look up and list the number of a local taxi or car service in your community. Include the company name and telephone number.
    13·1 answer
  • Each cout statement has a syntax error. Type the first cout statement, and press Run to observe the error message. Fix the error
    11·1 answer
  • A department store plans to upgrade its IT infrastructure to support a new order-processing application with rich features. The
    13·1 answer
  • Does anyone know the point of gradpoint?
    8·1 answer
  • Please Help meeeeeeeeeee:
    11·2 answers
  • MR. Tom asked her students could they plant a flower and bring it to class. Sarah brought his flower and said it was a rose. Jam
    6·1 answer
  • Requests to retrieve data written in a language such as SQL are called…
    8·1 answer
  • 7 TH GRADE QUESTION...PLS HELP
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!