Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the following basic program, implement the distance method and the degrees2ra

ID: 3638399 • Letter: I

Question

In the following basic program, implement the distance method and the degrees2radians method. Put your methods after the appropriate Javadoc comments.


public class Toss {
public static void main(String[] unused) {
java.util.Scanner keyboard = new java.util.Scanner(System.in);
double fast;
double high;
double goal;
double howFar;
double miss;
// input how fast the ball is thrown
// input angle at which the ball is thrown
// distance the ball should go
// distance for this throw
// difference of throw from the goal
goal = Math.random() * 95.0 + 5.0; // random number from 5 - 100
do {
System.out.println(" Enter the angle and speed to throw a ball " +
goal+" feet");
high = keyboard.nextDouble();
fast = keyboard.nextDouble();
high = degrees2radians( high );
howFar = distance( high, fast );
// read the angle of the throw
// read the speed of the throw
// convert to radians
// calculate the distance thrown
// how far we missed
miss = Math.abs(goal - howFar);
System.out.println("The ball went "+ howFar +" missing the target by "+
miss +" feet");
} while (miss > 2.0); // repeat until close enough
}
/**
* Method to calculate the distance a ball will travel.
* @param angle The angle in radians the ball is thrown.
* @param speed How fast the ball is thrown in feet / sec. * @return distance the ball will travel in feet.
*/
/**
* Method to convert degrees to radians.
* @param degrees The angle in degrees.
* @return The angle in radians.
*/
}

Explanation / Answer

public class DegreeToRadians { public static void main(String[]args) { //90 degree double degree=90; //Get radians value for 90 degree double radians=Math.toRadians(degree); System.out.println(radians); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote