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
The first number is 5 less than 3 times the second number. Twice the first number plus the second number is 137. Find the two nu
Irina-Kira [14]
5-3+10+137 10 and 137 are your numbers hope this helped 
8 0
3 years ago
Calculate the speed of a car that went a distance of 125 miles in 2 hours<br> time.
DerKrebs [107]

Answer:

62.5

Step-by-step explanation:

speed = distance / time taken

= 125/2

=62.5miles per hour

5 0
3 years ago
Use counting to determine the whole number that corresponds to the cardinality of these sets:______. (a) A= (xl x € Nand 20.&lt;
Harlamova29_29 [7]

Answer:

Step-by-step explanation:

Cardinality of a set is defined as number of element in a set. It is represented as n(X) where X is any set.

a) Given the set A =(x l x € N and 20.< x<27). According to the set, the set contains the values of natural numbers between 20 and 27. The values are 21, 22, 23, 24, 25 and 26

A = (21, 22, 23, 24, 25, 26)

According to the set A, it can be seen that there are 6 elements in the set, <em>this means n(A) = 6.</em>

b) Given B=(x | xeN and x+1=x)

Since natural numbers starts from 1, the first element in the set is 2 i.e 1+1

The elements of the set B = (2, 3, 4, 4...)

<em>The number of whole number in the set is therefore infinite. </em>

c) For the set C={x l xe N and (x- 1)(x - 9) = 0)

We need to get the root of the equation  (x- 1)(x - 9) = 0

x-1 = 0 and x-9 = 0

x = 1 and x = 9

Hence the element C = (1,9)

<em>The number of whole number in the set is n(C) = 2</em>

d)  D={xlx E N, H X 5 100, and x is divisible by both 5 and 8)

Given the value of x between 5 and 100, the values of x divisible by 5 = (10, 15, 20, 25, 30, 35, 40, 45, 50 , 55, 60 , 65, 70, 75, 80 85, 90, 95)

values of x divisible by 8 = (16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96)

<em>The total number of elements in both set = 29 i.e n(D) = 29 </em>

3 0
3 years ago
A machine packs 180 boxes of cereal in a half-hour. It takes 55 minutes to pack 330 boxes. True or False?
frozen [14]
I think that the answer is true
6 0
2 years ago
Can someone help ? ASAP thanks
Ahat [919]

Answer:

2,5 then 17 20 then keep adding 15 for x and y

6 0
3 years ago
Other questions:
  • the experimental drug caused side effects in 32% of those who took it. If 2880 experienced side effects, how many people took th
    10·1 answer
  • Given that the fracture toughness is at least 27,
    6·1 answer
  • A right pyramid that is 12 feet tall has a square base whose side length is 5 feet. What is its slant height, what is the length
    10·1 answer
  • Ignore the paragraph part just part a and part b, please &amp; thank you!
    12·1 answer
  • Given the point (-3, 6) and a line y=2x-8, write an equation of a line through the point and parallel to the line.
    10·1 answer
  • How to find missing angles parallel
    9·1 answer
  • Elana can swim 12 laps in 4 minutes. Fill in the blanks in the double number line to show
    13·1 answer
  • A cylinder has a radious of 6 ft and a height of 8 ft what is the volume of the cylinder?
    9·2 answers
  • What's the difference between two step equations and one step equations
    13·2 answers
  • Can someone tell me the answer please I’m marking brainlist
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!