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
Write a recursive function named canmakesum that takes a list of * integers and an integer target value (sum) and returns true i
valentinak56 [21]

// Java program to find sum of array

// elements using recursion.

class Test {

   static int arr[] = { 1, 2, 3, 4, 5 };

   // Return sum of elements in A[0..N-1]

   // using recursion.

   static int findSum(int A[], int N)

   {

       if (N <= 0)

           return 0;

       return (findSum(A, N - 1) + A[N - 1]);

   }

   // Driver method

   public static void main(String[] args)

   {

       System.out.println(findSum(arr, arr.length));

   }

}

7 0
2 years ago
Which type of microscope can only be used to view non-living specimens?
Fynjy0 [20]

Answer is D: Electronic microscope

An electronic microscope has greater resolving power and much higher magnifications. Most high-resolution electron microscope cannot be used to image living cells because the particle beam of powerful electrons used to illuminate a specimen also destroys the samples. Engineers, however, are coming up with ways to overcome this critical limitation by using quantum mechanical measurement. Quantum mechanical measurement will help avoid damage to the specimen by sensing objects remotely without ever hitting the imaged object.

5 0
3 years ago
Read 2 more answers
Create a mobile app plan using PowerPoint slides to show mock-ups of screens,
TiliK225 [7]

Answer: Have you gotten an answer yet?

6 0
3 years ago
In disc brakes, pads are forced against the of a brake disc​
Arturiano [62]

Answer:

Explanation:

It's the surface the brake pads contact. When you step on the brakes, pressurized brake fluid pushes against the pistons inside the caliper, forcing the brake pads against the rotor. As the brake pads press against both sides of the disc, the friction stops the wheel's rotation.

6 0
2 years ago
What is earning potential?
Natalka [10]

Answer:

Earning potential often refers to the top salary for a particular field or profession. In the finance world, the meaning is not much different: earning potential is the biggest profit a company could potentially make.

Explanation:

Earning potential often refers to the top salary for a particular field or profession. In the finance world, the meaning is not much different: earning potential is the biggest profit a company could potentially make.

4 0
3 years ago
Other questions:
  • _____ is a valuable tool that enables you to find information on the web by specifying words or phrases know as keywords- which
    14·1 answer
  • Why are video texts an example of multimedia? A. They use audio and visual elements together. B. They use one type of medium to
    13·2 answers
  • 1. Create a detail report that will display all SCR courses in alphabetical order, with the course name and the instructor name
    6·1 answer
  • Which player type focuses on level progression?
    13·1 answer
  • If your problem is caused by a bad hardware or software installation and you get an error message the first time you restart the
    6·1 answer
  • Which two actions allow the System Administrator to limit Chatter access during roll-out to a subset of Salesforce users?
    9·1 answer
  • The breastbone or ________________ extends down the chest.
    5·1 answer
  • Write assembly programs with the following I/O
    15·1 answer
  • What is an operating system?<br>​
    11·2 answers
  • How many countries don't uses the metric system?​
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!