0% found this document useful (0 votes)
2 views1 page

Assignment 01 C

The assignment requires writing a Java program that generates two random numbers for the base and height of a right triangle, computes the hypotenuse, and displays all values in a formatted manner. It emphasizes the use of doubles, the Math class for calculations, and proper formatting with DecimalFormat. Additionally, students must submit the source code, a screen capture of results, commented code, and generated Java documentation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Assignment 01 C

The assignment requires writing a Java program that generates two random numbers for the base and height of a right triangle, computes the hypotenuse, and displays all values in a formatted manner. It emphasizes the use of doubles, the Math class for calculations, and proper formatting with DecimalFormat. Additionally, students must submit the source code, a screen capture of results, commented code, and generated Java documentation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment 01C– COSC1046

Write a simple Java program that


 uses two random numbers between 0 and 6 for
base and height of a right triangle
 computes the hypotenuse
 displays all three values properly formatted
 uses a constant (class variable) for 2.0

Hints:
 Hint 1 -- Use doubles all the way through
 Hint 2 -- To compute square root and power look up the
Math class methods pow and sqrt
 To use pow function, please understand the statement
below:

double d = Math.pow(a, 2.0);


 Hint 3 – receive input data and convert them into double

 Hint 4 -- To make floats look neater, enclose them in a


format method call (be sure to import java.text
package)

 In System.out.println(hyp)
 use the following statement in place of hyp
DecimalFormat.getInstance().format(hyp);

Submit the Following to the dropbox in Slate:


1. source code
2. screen capture of results
3. source code must be commented
4. Generate Java documentation using Javadoc command and
submit index.htm file

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy