Fun With Numbers Java Programming Assignment
• Sequence structure
• Arithmetic operators: +, – , * , /
• Use of ints and doubles for variable declarations
• Appropriate documentation
Write an application that determines the characteristics of the right triangle show below
given the length of sideA and sideB and then outputs the results
The output of your program should look exactly like this:
Welcome to the Fun with Numbers Program:
The Points of the Triangle are:
A: (0,0) B: (0,6) C: (5,0)
The Length of the sides are:
The Characteristics of the Triangle are:
Slope of Hypotenuse: -1.2
Hypotenuse Midpoint: (2.5,3.0)
Steps and Notes:
1. Create a project called FunWithNumbers 2. Start with the sample code shown at the end of this assignment. It is also
available as a download in Canvas.
3. Populate the header with the appropriate information. 4. Declare any additional variables you need (In the variables section). When you
declare them, determine if they need to be integers or floating point.
5. In the Processing Section, perform the calculates needed to find the length of the Hypotenuse, the slope, etc…
6. Also in the Processing Section, massage all the floating point values so they only display 2 decimal places*.
7. In the Output Section, print out the results of the input and your calculations. Again, it should look exactly as shown above.
a. Your output statements CANNOT make use of any numeric literals other than ZERO. All other values must be displayed using the variables you
b. The alignment must match the alignment shown above. 8. Include any additional comments and make sure your indentation is consistent.
• Soft Copy of the program via Canvas (Just the .java file)
*Formatting Floating Point Numbers: The algorithm to display at most two decimal
values is as follows:
• Multiply the number by 100 to move the decimal two places to the right.
• Convert the number to an integer value
• Divide the number by 100.0 to move the decimal two places to the left. (Why did we write 100.0 instead of 100?)
Skeleton of code to start:
* @author you
public class FunWithNumbers
public static void main(String args)
final int SIDE_A_LENGTH = 6; // Length of the height
final int SIDE_B_LENGTH = 5; // Length of the base
// Variables (Declare additional as needed)
int sideA, // Three sides of a right Triangle
// Input (Already set)
sideA = SIDE_A_LENGTH;
sideB = SIDE_B_LENGTH;
// Calculate sideC, area, perimeter, etc.
// Massage any variables that will display more than
// two decimals places.
// Output (Write all output statements here
System.out.println(“The Points of the Triangle are:”);