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
Ira Lisetskai [31]
3 years ago
6

Create a new project called 02.03 Math Class Methods. Create a class called PyTheorem in the newly-created folder. Use the appro

priate Math class methods to calculate the hypotenuse of two right triangles. The value of each side (sides a and b) should be randomly generated using Math.random(). The range should from 5 (inclusive) to 23 (exclusive). Print the value of each side of both triangles as well as the value of the hypotenuse for both triangles.
Mathematics
1 answer:
SashulF [63]3 years ago
6 0

Answer:

The program in Java is as follows:

import java.util.*;

public class PyTheorem{

   public static void main(String [] args){

       Random rNum = new Random();

       int a = rNum.nextInt(17) + 5;

       int b = rNum.nextInt(17) + 5;

       System.out.println("a: "+a);

       System.out.println("b: "+b);

       double hyp = Math.sqrt(Math.pow(a,2)+Math.pow(b,2));

       System.out.print("Hypotenuse: "+hyp);

   }}

Step-by-step explanation:

This generates random number for a

       int a = rNum.nextInt(17) + 5;

This generates random number for b

       int b = rNum.nextInt(17) + 5;

Print a

       System.out.println("a: "+a);

Print b

       System.out.println("b: "+b);

Calculate the hypotenuse

       double hyp = Math.sqrt(Math.pow(a,2)+Math.pow(b,2));

Print the calculated hypotenuse

       System.out.print("Hypotenuse: "+hyp);

You might be interested in
7.21 repeating as a fraction
GalinKa [24]

Answer: 721/100 is 7.21 as a simplified fraction.

3 0
3 years ago
Read 2 more answers
Which line from "I'm Not Thirteen Yet" shows Jamie’s excitement as she plays soccer?
mixer [17]

Answer:

none of it

Step-by-step explanation:

6 0
3 years ago
Find the surface area of a sphere with radius of 8inches
diamong [38]

Answer:

200.96in

Step-by-step explanation:

I used this equation with 3.14 as pi

Area = 1/2 * 2radius*pi * radius

6 0
4 years ago
Factor : 21y^2 + 105y
expeople1 [14]
Gcf first
21y(y+5)
solutions are 0,-5
7 0
3 years ago
Read 2 more answers
What word describes the equal shares of a shape
Sloan [31]
The word will depend on how many equal shares there are. For example, if there are two equal shares, you can say "halves"; if there are three equal shares, you can say "thirds"; if there are four equal shares, you can say "quarters," etc.
4 0
3 years ago
Read 2 more answers
Other questions:
  • 2(4x - 3) - 8 = 4 +2x
    5·2 answers
  • B) What is the gradient of the line x + 2y = 1
    10·1 answer
  • Chloe collected 4 times as many bags of cans as her friend. if her friend collected 1/6 of a bag how much did Chloe collect
    11·1 answer
  • Given the equation y-5=5x determine whether the points (2,12) and (-2,-5) are solutions on the graph
    11·1 answer
  • This figure consists of a rectangle and semicircle. What is the perimeter of this figure? Use 3.14 for pi. 19.42 cm 20.28 cm 23.
    13·2 answers
  • PLEASE HELP ASAP For each expression below, select the letter that corresponds to the equivalent expression from the given list.
    14·1 answer
  • Out of 36 people in a parade, 18 are wearing red, 15 are wearing blue, and 7 are wearing both red and blue. How many people were
    13·1 answer
  • Find the values of x and y which satisfy the following equations
    11·1 answer
  • Someone help pleasee
    11·2 answers
  • Lakelyn has $2,500.00 to invest in a savings account. Savings account 1 earns 4% simple interest and savings account 2 earns 4%
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!