Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.text.DecimalFormat; import java.util.Random; public class RightTriangle { public static final double CONSTANT = 2 . 0 ; public static void main ( String [

import java.text.DecimalFormat;
import java.util.Random;
public class RightTriangle {
public static final double CONSTANT =2.0;
public static void main(String[] args){
Random rand = new Random();
double base = rand.nextDouble()*6;
double height = rand.nextDouble()*6;
double hypotenuse = Math.sqrt(Math.pow(base, CONSTANT)+ Math.pow(height, CONSTANT));
DecimalFormat df = new DecimalFormat("0.00");
System.out.println("Base: "+ df.format(base));
System.out.println("Height: "+ df.format(height));
System.out.println("Hypotenuse: "+ df.format(hypotenuse));
}
}
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

Are upfront payments considered separate performance obligations?

Answered: 1 week ago

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago

Question

What do you mean by Dividend ?

Answered: 1 week ago

Question

3. What are potential solutions?

Answered: 1 week ago

Question

4. I can tell when team members dont mean what they say.

Answered: 1 week ago