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
The most important criteria of a good tracking method is that it is ______. a. Comfortable b. Computer compatible c. Portable d.
AnnyKZ [126]

Answer:

Comfortable

Explanation:

The most important criteria of a good tracing method is that it is comfortable. because, if you are not comfortable you cannot pay head to their work properly.You cannot made decision and you can also not to recognize your improvements during tracking.

8 0
4 years ago
Read 2 more answers
What do you understand by the term polysome?​
jasenka [17]

Answer:

A polyribosome (or polysome or ergasome) is a group of ribosomes bound to an mRNA molecule like “beads” on a “thread”. It consists of a complex of an mRNA molecule and two or more ribosomes that act to translate mRNA instructions into polypeptides.

6 0
3 years ago
The ____ is the ranking executive on-site when the crisis or emergency arises, who is authorized to initiate the CM plan.
aleksklad [387]

The answer is the Executive-in charge

The concept of an Executive-in charge came from the military’s chain of command. A chain of command ranges from a supervisor to the top executive of the organization. When a crisis arises, it is possible that one or more of the senior top managers may not be available for consultations because of the travel-intensive positions.






7 0
4 years ago
Read 2 more answers
Explain the third <br> generation
meriva
Computers were computers that emerged due to the development of the integrated circuit.
8 0
3 years ago
A spreedsheet program display data in a special document called a
Tamiku [17]
Google sheets. or excel. 
7 0
3 years ago
Read 2 more answers
Other questions:
  • A .jpg file is an example of which of the following file types
    15·2 answers
  • What type of computer is likely to use so-dimms, have an internal power supply, and use a desktop processor socket?
    10·1 answer
  • How to find out if your Mac has been hacked
    12·1 answer
  • Write a single if-test using Boolean operators and relaional operators to determine if a double variable x is between zero (excl
    11·1 answer
  • Classify the following skills: communication, creativity, and independence.
    15·1 answer
  • Critical Thinking Questions
    15·2 answers
  • Write the code for the method getNewBox. The method getNewBox will return a GiftBox that has dimensions that are m times the dim
    14·1 answer
  • One vulnerability that makes computers susceptible to walmare is:
    13·2 answers
  • Q1. Information systems that monitor the elementary activities and transactions of the organizations are: I a. Management-level
    11·1 answer
  • Which two extensions in scratch are correctly matched to their accessibility goals
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!