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
-Dominant- [34]
3 years ago
5

Write a test program that prompts the user to enter three sides of the triangle (make sure they define an actual triangle), a co

lor, and a Boolean value to indicate whether the triangle is filled.
Computers and Technology
1 answer:
Ivanshal [37]3 years ago
7 0

Answer:

   Scanner in = new Scanner(System.in);

       System.out.print("Please enter 3 sides of a triangle, color and " +

                       "whether it is filled or not (true false): ");

       double s1 = in.nextDouble();

       double s2 = in.nextDouble();

       double s3 = in.nextDouble();

       String color = in.next();

       boolean filled = in.nextBoolean();

       

       Triangle t1 = null;

       

       try {

           t1 = new Triangle(s1, s2, s3, color, filled);

       }

       catch (IllegalTriangleException ite) {

           System.out.println(ite.toString());

       }

       

       System.out.println(t1.toString());

       System.out.printf("Triangle color: %s, Triangle filled: %s%n" +  

                       "Area: %.2f%n" +  

                       "Perimeter: %.2f%n%n",

                   t1.getColor(),  

                   t1.isFilled(),

                   t1.getArea(),

                   t1.getPerimeter());

           

Explanation:

   Scanner in = new Scanner(System.in);

       System.out.print("Please enter 3 sides of a triangle, color and " +

                       "whether it is filled or not (true false): ");

       double s1 = in.nextDouble();

       double s2 = in.nextDouble();

       double s3 = in.nextDouble();

       String color = in.next();

       boolean filled = in.nextBoolean();

       

       Triangle t1 = null;

       

       try {

           t1 = new Triangle(s1, s2, s3, color, filled);

       }

       catch (IllegalTriangleException ite) {

           System.out.println(ite.toString());

       }

       

       System.out.println(t1.toString());

       System.out.printf("Triangle color: %s, Triangle filled: %s%n" +  

                       "Area: %.2f%n" +  

                       "Perimeter: %.2f%n%n",

                   t1.getColor(),  

                   t1.isFilled(),

                   t1.getArea(),

                   t1.getPerimeter());

           

You might be interested in
A student wants an algorithm to find the hardest spelling word in a list of vocabulary. They define hardest by the longest word.
makkiz [27]

Answer:

Initialize the “longest word” by an empty string and update it when a longer word is found

Explanation:

import java.util.stream.Stream;

public static String findLongest(String[] spellingList) {

   return Stream.of(spellingList).reduce("", (longestWord, word) -> (

       longestWord.length() < word.length() ? word : longestWord

   ));

}

5 0
2 years ago
Which of the following is an example of new and emerging classes of software?
Rama09 [41]
The answer is Smart technology :)
4 0
2 years ago
Q.drtrdyudoijoemrkdf
sveta [45]

Answer:

Yes

Explanation:

8 0
2 years ago
Read 2 more answers
CottonPlus, a sportswear company, is releasing a new casual sportswear line. The company approaches a basketball star to endorse
Airida [17]

Answer: Tactics

Explanation:

  According to the given question, the tactics is one of the type of element of the given program planning that helps in illustrating the given scenario as by using the various types of tactics marketing approach we can easily promote the products in the market.

  • The tactics is one of the legal or authorized element which deals with the new products in the market.
  • In the given scenario, the Cotton Plus is one of the sportswear organization and the main strategy of the company is to approach the basketballs stars for promoting their latest collection.

 Therefore, Tactics is the correct answer.

3 0
3 years ago
Which of these statements regarding mobile games is true?
SashulF [63]

Answer:

A. They are typically played in doors.

Explanation:

Most logical answer

8 0
3 years ago
Read 2 more answers
Other questions:
  • A friend has a CD of one of your favorite artists and has offered to let you copy it.
    8·1 answer
  • How to make your keyboard sound like a piano?
    9·1 answer
  • The "network of networks," consisting of LANs (Local Area Networksnetworks connecting two or more computers, usually within the
    5·1 answer
  • An indicator is a comprehensive analysis of critical information
    8·1 answer
  • Which finger types the return or enter key?
    6·2 answers
  • Which of the following is not a metamorphic agent?
    8·2 answers
  • A hacker uses a valid IP address of an internal host, and then from an external system, the hacker attempts to establish a commu
    11·1 answer
  • Characters used to control the position of the output on the screen or paper, to cause some action to occur, such as ringing a b
    10·1 answer
  • What is the computer that is similar to a destop but smaller in size
    8·1 answer
  • Working with text in presentation programs is similar to using text in other applications
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!