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
RUDIKE [14]
3 years ago
5

Create the IllegalTriangleException class, and modify the constructor of the Triangle class to throw an IllegalTriangleException

object if a triangle is created with sides that violate the rule, as follows:
Computers and Technology
1 answer:
Nady [450]3 years ago
4 0

Complete question:

Create the Illegal Triangle Exception class, and modify the constructor of the Triangle class to throw an Illegal Triangle Exception object if a triangle is created with sides that violate the rule as follows:

/** Construct a triangle with the specified sides */

public Triangle (double side1, double side 2, double side 3)

throws IllegalTriangleException {

// Implement it

}

Answer:

We have to guess at the original Triangle class as you didn't provide it, so I'll provide a skeleton.

For a triangle to be "legal" all sides should have a positive, non-zero length; and the sum of any two sides should be greater than the length of the third.

public class IllegalTriangleException extends Exception {

public IllegalTriangleException() {}

public IllegalTriangleException(String msg) { super(msg); }

};

public class Triangle

{

// Missing info ...

private double a, b, c;

public Triangle (double side1, double side 2, double side3 )

   throws IllegalTriangleException

{

     if ((side1 + side2 > side3) || (side1 + side3 > side2) || (side2+side3 > side1))

   throw new IllegalTriangleException("Illegal side ratios");

     if (side1 <= 0.0 || side2 <= 0.0 || side3 <= 0.0 )

   throw new IllegalTriangleException("Side lengths must be >= 0");

     a = side1; b = side2; c = side3;

}

};

Explanation:

You might be interested in
The Internet was first used by which of the following institutions?
Phantasy [73]

Answer:

U.S Department of Defense

Explanation:

(btw nazi party was around before the internet and ended before the internet therefor couldn't be that)

5 0
3 years ago
Examples of domain names and usernames<br><br><br><br>​
svp [43]

Answer:

examples are:

com or .edu is a top-level domain name (TLD)

cornell.edu is a second-level domain name (SLD)

bigred.cornell.edu is a third-level or three-part domain name

project.bigred.cornell.edu is a fourth-level or four-part domain name

hope this helps you.

4 0
3 years ago
An administrator has initiated the process of deploying changes from a sandbox to the production environment using the Force IDE
Pani-rosa [81]

Option A because the environment should be selected for which the changes are to be applied. In a time Force IDE has many project environments for example maybe a java project and C++ project would be there on sandbox, so the environment selection is important.

Option B because the related changed sets should be specified so that other developers that have access to the project can see the changes being made.

Option D The data fields that are needed to be deployed should also be provided so that the updated version can be seen by other developers.

Rejected Options :

Option C user name and password has nothing to do with the production environment because if the user has it only then it can come and make changes.

6 0
3 years ago
What is a variable in programming?
HACTEHA [7]
A symbol or set of characters in a programming statement whose value can be changed
3 0
3 years ago
Question 6 options: This is a category or partitioned group of the small units of a programming language include its numeric lit
Wittaler [7]

Lexeme is a category or partitioned group of the small units of a programming language include its numeric literals, operators, and special words.

<h3>What is a lexeme in programming?</h3>

Lexemes are known to be those character strings that are put together from the character group of a program, and the token stands for what aspect of the program's grammar they are made of.

Hence, Lexeme is a category or partitioned group of the small units of a programming language include its numeric literals, operators, and special words.

Learn more about Lexeme from

brainly.com/question/14125370

#SPJ1

6 0
2 years ago
Other questions:
  • The _____ command icon looks like a small clipboard with a page attached.
    6·1 answer
  • Reggie has hired you to design a home network. The home network will share a printer but will mainly be used to stream movies to
    7·1 answer
  • How many unique ip addresses can be made in a fixed-length ip address system using 6 bits?
    8·1 answer
  • Write a MARIE program to calculate some basic statistics on a list of positive numbers. The program will ask users to input the
    6·1 answer
  • Consider a system that uses a 32-bit unique salt where users have a 4-digit number as a password (e.g. 6813). Eve wants to crack
    8·2 answers
  • What are 2 main differences betweenarrays andstructs?
    7·1 answer
  • True or false? The following deterministic finite-state automaton recognizes the set of all bit strings such that the first bit
    7·1 answer
  • Write: In a five-paragraph essay that is two to three pages in length, address the
    13·1 answer
  • What do you think Amazon should fix?
    13·2 answers
  • Consider the following variable declarations and initializations.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!