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
LiRa [457]
3 years ago
10

Given class Triangle (in file Triangle.java), complete main() to read and set the base and height of triangle1 and of triangle2,

determine which triangle's area is larger, and output that triangle's info, making use of Triangle's relevant methods. Ex: If the input is: 3.0 4.0 4.0 5.0 where 3.0 is triangle1's base, 4.0 is triangle1's height, 4.0 is triangle2's base, and 5.0 is triangle2's height, the output is: Triangle with larger area: Base: 4.00 Height: 5.00 Area: 10.00
Computers and Technology
1 answer:
kodGreya [7K]3 years ago
8 0

Answer:

<em>The Triangle.java file is not provided; However, the program is as follows;</em>

<em>Comments are used for explanatory purpose</em>

<em>Also see attachment for Triangle.java program file</em>

<em />

import java.util.*;

public class triangle

{

public static void main(String [] args)

{

 Scanner input = new Scanner(System.in);

 //Declare variables

 double base1, height1, base2, height2;

 //Prompt user for inputs

 System.out.println("Provide values for the base and height of the two triangles");

 System.out.print("Base of Triangle 1: ");

 base1 = input.nextDouble();

 System.out.print("Height of Triangle 1: ");

 height1 = input.nextDouble();

 System.out.print("Base of Triangle 2: ");

 base2 = input.nextDouble();

 System.out.print("Height of Triangle 2: ");

 height2 = input.nextDouble();

 //Compare and Print Results

 if(0.5 *base1 * height1 > 0.5 * base2 * height2)

 {

  System.out.print("Triangle with larger area: Base: "+base1+" Height: "+height1+" Area: "+(0.5 * base1 * height1));

 }

 else

 {

  System.out.print("Triangle with larger area: Base: "+base2+" Height: "+height2+" Area: "+(0.5 * base2 * height2));

 }

}

}

Download java
You might be interested in
Which of the following is true about advertisements?
katrin [286]

the answer is they often contain biases :)

3 0
2 years ago
What tabs found in the Windows Task Manager dialog box
fredd [130]
The applications you have open, and some background processes.
7 0
3 years ago
In Microsoft word you can access the blank command from the mini toolbar
Softa [21]
Your answer would be:
<span>
In Microsoft Word you can access the </span><span>insert citation command from the mini toolbar.</span>
3 0
3 years ago
If a 9V, 7W radio is on from 9am to 12pm. Calculate the amount of charge that flows through it, hence or otherwise the total num
vredina [299]

Answer:

Q=It

and

p=IV

Given, v=9V P= 7W

I=P/V

I =7/9

Also, time(t) from 9am to 12pm is 3hrs

Converting into sec =3×3600

t=10800

Q= 7/9 ×10800

Q =8400C

6 0
2 years ago
What mode is generally used when delivering a presentation to an audience?
dybincka [34]

Answer:

delivery mode

Explanation:

there it is

7 0
3 years ago
Read 2 more answers
Other questions:
  • What is a bus master?
    14·1 answer
  • When a dynamic array with a class for a base type is declared, which constructor is called?
    5·1 answer
  • Virtually all webcams plug into a(n) ________ port.
    13·2 answers
  • Why is network security important? Check all of the boxes that apply. A. Network security allows organizations to continue to fu
    8·1 answer
  • When an application contains just one version of a method, you can call the method using a(n) ____ of the correct data type.
    6·1 answer
  • SO I LIKE BOILED EGGS AND MY MUM WAS MAKING SALAD FOR DINNER SO I SAID DID YOU MAKE AND EGG-TRA ONE FOR ME
    13·1 answer
  • How is data written to a blockchain?
    10·1 answer
  • First Computers and Technology question in 4 years..
    11·1 answer
  • 12. Your project specifications call for a business rule that the database design can't
    8·1 answer
  • In addition to developing sketches, computer-aided design programs are used by fashion designers to perform which task?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!