Programming Homework Help

Rutgers University Library Methods Ladder Program

 

Ladder program 

This program will start by asking the user in a dialog box if they need a ladder and give them, yes and no buttons to click on. If the user clicks no, the program will end.

Use the proper type of dialog box with all arguments (this will be the only dialog box).  

If they click yes, the program will place a ladder against the side of a house (see diagram). 

The program will pick a Math random-sized ladder between 15 and 25 feet (it will be in whole feet).  

The program will lean it against the house at a Math random number of degrees between 60 and 75 (it will be in whole degrees).  

You will then convert the degrees to radians (use the library method).  

You will then calculate the height of the ladder (use the sine of opposite over hypotenuse – the sine of the number of radians times the ladder size).  

You will then calculate the distance of the ladder from the house (forms a right triangle with the ladder as the hypotenuse with hypotenuse squared is the sum of the other 2 sides squared, so solve for the distance). 

You must use the above formulas, all static library methods, and all arguments whenever possible.  

You will then print to the console output screen everything labeled: 

the random size of the ladder

the random number of degrees of the angle where the ladder leans against the side of the house 

the corresponding radians of the angle

the calculated height of the ladder up the house

the calculated distance the ladder is from the house

(all doubles to one decimal place).

Document your program with at least name, exercise number, and at least 5 lines explaining what the program does.  You will also add comments to at least 5 individual lines in the program (comment lines that might not be totally obvious to a novice programmer).  

Run your program 2 times clicking the yes button (to show the random numbers and the calculations are working) and 1 time clicking the no button.

Save the source code .java file and the output .txt file (saved from the Console) from the 2 yes runs.