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
r-ruslan [8.4K]
3 years ago
14

Write a function that takes the base and height of a triangle and return its area.

Mathematics
1 answer:
antoniya [11.8K]3 years ago
8 0
<h2><u>Answer:</u></h2>

<u></u>

    //Method/function name is areaOfTriangle

    //Return type is double

    //Method receives two parameters of type double - base and height

    public static double areaOfTriangle(double base, double height){

        //Find the area using the formula: 1/2 * base * height

        double area = 0.5 * base * height;

       

        //return the area

        return area;

       

   } //End of areaOfTriangle method

<h2><u>Step-by-step explanation:</u></h2>

<u></u>

The function above has been written in Java.

It contains comments explaining each line of the code. Please go through the comments.

In order to test the function, a complete program containing a main method has also been written. This is shown as follows;

//Class definition begins

public class Area{

       

    //Method/function name is areaOfTriangle

    //Return type is double

    //Method receives two parameters of type double - base and height

    public static double areaOfTriangle(double base, double height){

        //Find the area using the formula: 1/2 * base * height

        double area = 0.5 * base * height;

       

        //return the area

        return area;

       

    }  //End of areaOfTriangle method

   

   

    //Write the main method to call the method

    public static void main(String []args){

       

       //Call the areaOfTriangle() method in the main method

       //Set the base to 12 and the height to 6

       System.out.println(areaOfTriangle(12, 6));

    }

   

   

} //End of class definition

<h2><u>Sample Output</u></h2>

>> 36.0

You might be interested in
A circle has a center at (5, 5) and a radius of 2. If the format of the equation for the circle is (x − h)2 + (y − k)2 = r2, the
earnstyle [38]

Answer:

D:  r^2 = 4

Step-by-step explanation:

Square the radius:  r^2 = 2^2 = 4 (answer)

5 0
4 years ago
Calvert Cell Phone Company offers a plan that costs $20 a month plus $.07 per minute. •write an equation for a total monthly bil
Vladimir79 [104]
Y=20+0.7x

x has to be per minute and 20 is alone bc that is the baseline

4 0
3 years ago
Read 2 more answers
Fraction - write the equivalent mixed number : 50/7 = ? (7 1/7) please can you help me to learn how it becomes 7 1/7 can you sho
IgorLugansk [536]

Explanation:

When you perform long division of 50 by 7, you find that the quotient is 7 and the remainder is 1. The remainder expressed over the original divisor is the fraction. (In some cases, that fraction may need to be reduced.)

That is ...

\dfrac{50}{7}=\dfrac{49+1}{7}=\dfrac{7\cdot 7+1}{7}\\\\=\dfrac{7\cdot 7}{7}+\dfrac{1}{7}=7+\dfrac{1}{7}=7\frac{1}{7}

7 0
3 years ago
The variables y and x have a proportional relationship, and y = 15 when x = 3. What is the value of x when y = 4?
Akimi4 [234]

Answer:

x=\frac{4}{5}=0.8

Step-by-step explanation:

We have been given that the variables y and x have a proportional relationship, therefore, we can represent the relationship between x and y as: y=kx, where k is proportionality constant.

Let us substitute x=3 and y=15 in above equation to find the value of k.

15=k*3

k=\frac{15}{3}

k=5

Now let us substitute k=5 and y=4 in our proportionality equation to find the corresponding value of x.

4=5x

x=\frac{4}{5}

x=0.8

Therefore, the value of x will be 0.8, when y equals to 4.

4 0
4 years ago
13^-11x13^16x13^-3x13^^4x13^-5
stiv31 [10]
Since the bases are all 13, keep the base and add the powers.
13^(-11 + 16 + -3 + 4 + -5)
13^1 = 13
4 0
4 years ago
Other questions:
  • Danielle earns a 7.75% commission on everything she sales at the electronic store where she works. She also earns a base salary
    13·1 answer
  • How do you write 5x100+3x10+8x0.1+9x0.001
    12·1 answer
  • Maria drew two parallel lines KL and MN intersected by a transversal PQ, as shown below:
    10·2 answers
  • Find the circumstance of a CD that has a radius of 6 cm use pi' =3.14
    14·1 answer
  • I dont know this help me
    13·2 answers
  • WILL MARK BRAINLIEST PLS HELP
    10·1 answer
  • Please tell me the process to change a percent to a decimal
    11·2 answers
  • Help please, it's for a test due at 11:30 est; Determine if (x-6) is a factor of f(x)=2x^4-3x^3+4x-3. Explain.
    13·1 answer
  • Determine if line DE is parallel to line AC
    5·2 answers
  • You decide you will buy a stock only if it shows an overall increase over the next 30 days. In the first 10 days, the stock you
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!