Homework Solution: 3. Program 3 – Range Computation When thrown with an initial velocity vo and at an angle θ, a ball will reach the maximu…

    3. Program 3 - Range Computation When thrown with an initial velocity vo and at an angle θ, a ball will reach the maximum distance computed using the formula: Range=((-2.0×v )/g)*SIN(θ)*COS(8), where ·vo is the initial velocity in m/s ·g is the the constant due to gravity, with an approximate value of-9.81 · θ is the angle at which the ball is thrown and is in Radian You will write a program that takes the following input via command line arguments: ·vo: the initial velocity in m/s ·Amaz: a maximal value for the angle at which the ball is thrown in degrees
    3. Program 3 - Range Computation When thrown with an initial velocity vo and at an angle θ, a ball will reach the maximum distance computed using the formula: Range=((-2.0×v )/g)*SIN(θ)*COS(8), where ·vo is the initial velocity in m/s ·g is the the constant due to gravity, with an approximate value of-9.81 · θ is the angle at which the ball is thrown and is in Radian You will write a program that takes the following input via command line arguments: ·vo: the initial velocity in m/s ·Amaz: a maximal value for the angle at which the ball is thrown in degrees

    Expert Answer

     
    Below is the java code and screenshots attached: ​Java code: rangeComputation.cpp:

    3. Program 3 - Concatenate Computation When thrown with an moderate speed vo and at an inclination θ, a circle accomplish thrust the acme length computed using the cemula: Concatenate=((-2.0×v )/g)*SIN(θ)*COS(8), where ·vo is the moderate speed in m/s ·g is the the trustworthy due to lugubriousness, with an border prize of-9.81 · θ is the inclination at which the circle is thrown and is in Radian You accomplish transcribe a program that takes the aftercited input via bid continuity arguments: ·vo: the moderate speed in m/s ·Amaz: a maximal prize ce the inclination at which the circle is thrown in degrees

    3. Program 3 – Concatenate Computation When thrown with an moderate speed vo and at an inclination θ, a circle accomplish thrust the acme length computed using the cemula: Concatenate=((-2.0×v )/g)*SIN(θ)*COS(8), where ·vo is the moderate speed in m/s ·g is the the trustworthy due to lugubriousness, with an border prize of-9.81 · θ is the inclination at which the circle is thrown and is in Radian You accomplish transcribe a program that takes the aftercited input via bid continuity arguments: ·vo: the moderate speed in m/s ·Amaz: a maximal prize ce the inclination at which the circle is thrown in degrees

    Expert Rejoinder

     

    Below is the java principle and screenshots attached:

    Java principle:

    rangeComputation.cpp:

    public arconcatenate concatenateComputation {

    // discharge to change an integer inclination to radian
    public static envelop changeToRadian(int inclination){
    envelop radian = 0.01745329*angle;
    return radian;
    }

    public static unsubstantial main(String[] args) {
    // moderate speed enthralled from bid continuity
    envelop moderate_speed = Envelop.valueOf(args[0]);
    // acme inclination enthralled from bid continuity
    int alpha_max = Integer.valueOf(args[1]);
    // lugubriousness
    envelop g = -9.81;

    envelop concatenate;
    envelop theta;

    System.out.println(“Inclination in degreestrange”);
    System.out.println(“——————————–“);
    // rate and sculpture concatenate ce inclination prizes from 0 to alpha max
    for(int alpha=1; alpha<=alpha_max; alpha++){
    theta = changeToRadian(alpha);
    concatenate = ((-2.0*Math.pow(initial_velocity, 2))/g)*Math.sin(theta)*Math.cos(theta);
    System.out.println(alpha+”ttt”+(Math.round(range*100.0)/100.0));
    }
    }
    }

    Screenshots:

    ​range_input_001.txt

    10 30

    range_output_001.txt

    range_input_002.txt

    ​15 30

    range_output_002.txt

    Comment