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
Which of the following STEM discoverers is known as the “Prince of Math?”
Margarita [4]
The German mathematician & physicist ”Carl Friedrich Gauss”

Born: April 30, 1777, Brunswick, Germany
Died: February 23, 1855, Göttingen, Germany
8 0
3 years ago
What keyword can we use within a form to pass it as an argument to a JavaScript snippet? A. form B. onSubmit C. send D. this
astraxan [27]

C. send is your answer

3 0
2 years ago
Read 2 more answers
How are the stop lamp bulbs connected in relation to each other? a. In parallel. b. In series. c. In series/parallel. d. None of
laiz [17]

In Parallel option A is true

Because In parallel circuit, the voltage across each components is same and the total current is sum of the currents through each component.

6 0
3 years ago
Write a few statements that open a file called "greeting", write the message "hey!" to the file -- and then close it. declare an
pshichka [43]
C++:

int main () {

std::ofstream output {"greeting.txt"};
output << "hey!";
output.close();

return 0;
}
6 0
3 years ago
Read 2 more answers
Different Betweens in SRAM and DRAM !
den301095 [7]

Answer:

Explanation:

<u>Application Differences:</u>

<u>SRAM</u>

SRAM stands for Static Random Access Memory  DRAM stands for Dynamic Random Access Memory

Faster access is due to the usage of transistors to store single bit of data  

SRAMs are used for cache memories due to faster access time  

<u>DRAM</u>

DRAM stands for Dynamic Random Access Memory

DRAMs are used for main memories due to comparatively slower access time.

DRAMs use capacitor to store bits where each capacitor holds a single bit

<u>Parameter differences</u>  

<u>Speed:</u> SRAMs are faster due to presence of transistors. DRAMs are slower due to presence of capacitors

<u>Size:</u> Due to complexity involved in the internal circuits, SRAMs are smaller in capacity for same size of the chip. DRAMs are larger as compared to SRAMs since their capacity for a given physical size is more.

<u>Cost:</u> SRAMs are costlier and the per bit storage cost is more than that of the DRAMs. DRAMs are cheaper and the per bit storage cost is less than that of the SRAMs

5 0
2 years ago
Read 2 more answers
Other questions:
  • When a packet with the code is transmitted, it is received and processed by every machine on the network. this mode of operation
    12·1 answer
  • Gathering information with your eyes is called
    13·2 answers
  • Please describe in a few sentences
    14·1 answer
  • In the Mouse Properties window, you can?
    8·1 answer
  • Which of the following sentences is accurate? a. PDF stands for "Proofreading Direct Files." b. PDF files cannot be edited. c. B
    9·1 answer
  • Write a program to create a customer bill for a company. The company sells only five products: TV, DVD player, Remote Controller
    12·1 answer
  • Unscramble thr words <br>1.Nsieg Wiev<br>2.Seeathdat ievw​
    13·2 answers
  • When you login to your blogging account. The first screen with all controls, tools and functions is called .... Select one: a. D
    10·1 answer
  • Xbox one is not turning on and power brick is orange why is that?​
    6·1 answer
  • In reference to operating systems, what is spooling? what does it stand for? chegg
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!