Homework Solution: Your program must do the following in order to receive full credit on this assignme…

    Requirements Your program must do the following in order to receive full credit on this assignment. 1. Ask the user to provide the following values which you will store as a double, one at a time, with a proper message for each (ie, “Please type in the height). Velocity - The speed (in feet per second) at which the cannonball is fired. Angle - The angle (in degrees) above the ground at which the cannonball is fired (this is called the inclination angle in the above diagram). a. b. c. Distance This is the horizontal distance (in feet) to the target (RH in the above diagram) d. Elevation - The height (in feet) of the bottom of the target from the ground (y value on an x-y planc). Size - This is how tall the target is from its bottom (elevation) to its top (elevation + size). e. 2. Validate the users input. One of the calculations you need to do requires division and we must ensure that the denominator of the equation is not 0 a. Calculate (velocity * the cosine of angle in radians). Use the Math class for cosine and converting to radians. i. If that value if 0, print a message that the distance cannot be calculated with that input and do not continue. Otherwise, have the program continue to the next step b. program shoul i. That is, the rest The formula is (distance/ (velocity * the cosine of angle in radians). The formula is (velocity *time *the sine of the angle in radians ((32.17 * time t of the program should be in an else block. 3. Calculate the time it takes the object to reach the distance. a. 4. Calculate the height of the projectile at that distance. a. squared) / 2)) i. ii. Again, use the math class for the sine and squaring time. If youre having trouble with this formula, try breaking it into smaller parts. 5. Print the outcome of this cannonball shot. a. There are four possible outcomes and you should print a proper message for each one. Height is less than 0: This means that the cannonball did not even reach the target. Height is greater than 0 but less than the elevation of the target: This means the cannonball went under the target. i. ii. 1. Print the height of the cannonball as part of your message. Height is greater than elevation and less than elevation plus size: This means the cannonball hit the target! Height is greater than elevation plus size: The cannonball went over the top of the target. iii. iv. 1. Note: I worded the above conditions similar to how you you might consider setting up your if, else-if, and else statements, but there are other, better, ways to organize this. Give it some thought. Print the height of the cannonball as part of your message. v.
    Your program must do the following in order to receive full credit on this assignment. Ask the user to provide the following values which you will store as a double, one at a time, with a proper message for each (ie. "Please type in the height"). a. Velocity - The speed (in feet per second) at which the cannonball is fired. b. Angle - The angle (in degrees) above the ground at which the cannonball is fired (this is called the inclination angle in the above diagram). c. Distance This is the horizontal distance (in feet) to the target (RH in the above diagram) d. Elevation - The height (in feet) of the bottom of the target from the ground (y value on an x-y plane). e. Size - This is how tall the target is from its bottom (elevation) to its top (elevation + size). Validate the user's input. One of the calculations you need to do requires division and we must ensure that the denominator of the equation is not 0. a. Calculate (velocity * the cosine of angle in radians). i. Use the Math class for cosine and converting to radians. b. If that value if 0, print a message that the distance cannot be calculated with that input and do not continue. Otherwise, have the program continue to the next step. i. That is, the rest of the program should be in an else block. C. Calculate the time it takes the object to reach the distance. a. The formula is (distance/ (velocity * the cosine of angle in radians). d. Calculate the height of the projectile at the distance. a. The formula is (velocity *time *the sine of the angle in radians - ((32.17 * time squared)/2)) i. Again, use the math class for the sine and squaring time. ii. If you're having trouble with this formula, try breaking it into smaller parts. Print the outcome of this cannonball shot. a. There are four possible outcomes and you should print a proper message for each one. i. Height is less than 0: This means that the cannonball did not even reach the target. ii. Height is greater than 0 but less than the elevation of the target: This means the cannonball went under the target. Print the height of the cannonball as part of your message. iii. Height is greater than elevation and less than elevation plus size: This means the cannonball hit the target! iv. Height is greater than elevation plus size: The cannonball went over the top of the target. iv. Height is greater than elevation plus size: The cannonball went over the top of the target.

    Expert Answer

     
    import java.util.*; import java.lang.*;

    Requirements Your program must do the subjoined in manage to assent-to ample praise on this ordinance. 1. Ask the interpretationr to prepare the subjoined rates which you achieve hoard as a wrap, undivided at a occasion, with a peculiar referableice coercion each (ie, “Please intermissionraintm in the rise). Celerity - The urge (in feet per cooperate) at which the cannonball is fired. Turn - The turn (in degrees) balance the foundation at which the cannonball is fired (this is denominated the tendency turn in the balance diagram). a. b. c. Interspace This is the spiritshort interspace (in feet) to the target (RH in the balance diagram) d. Rise - The rise (in feet) of the reasonwork of the target from the foundation (y rate on an x-y planc). Extent - This is how elevated the target is from its reasonwork (elevation) to its summit (rise + extent). e. 2. Validate the interpretationrs input. Undivided of the calculations you want to do requires disruption and we must fix that the denominator of the equation is referable 0 a. Calculate (celerity * the cosine of turn in radians). Interpretation the Math dispose coercion cosine and converting to radians. i. If that rate if 0, sculpture a referableice that the interspace canreferable be congenial with that input and do referable live. Otherwise, accept the program live to the direct tread b. program shoul i. That is, the intermission The coercionmula is (distance/ (celerity * the cosine of turn in radians). The coercionmula is (celerity *occasion *the evile of the turn in radians ((32.17 * occasion t of the program should be in an else obstruct. 3. Calculate the occasion it takes the sight to arrive-at the interspace. a. 4. Calculate the rise of the missile at that interspace. a. squared) / 2)) i. ii. Again, interpretation the math dispose coercion the evile and squaring occasion. If youre having misery with this coercionmula, test infringement it into smaller faculty. 5. Sculpture the fruit of this cannonball shot. a. There are lewd practicable fruits and you should sculpture a peculiar referableice coercion each undivided. Rise is short than 0: This resources that the cannonball did referable well-balanced arrive-at the target. Rise is elder than 0 yet short than the rise of the target: This resources the cannonball went lower the target. i. ii. 1. Sculpture the rise of the cannonball as separate of your referableice. Rise is elder than rise and short than rise plus extent: This resources the cannonball succeed the target! Rise is elder than rise plus extent: The cannonball went balance the summit of the target. iii. iv. 1. Referablee: I worded the balance provisions congruous to how you you potentiality weigh contrast up your if, else-if, and else statements, yet there are other, meliorate, ways to adjust this. Give it some supposition. Sculpture the rise of the cannonball as separate of your referableice. v.

    Your program must do the subjoined in manage to assent-to ample praise on this ordinance. Ask the interpretationr to prepare the subjoined rates which you achieve hoard as a wrap, undivided at a occasion, with a peculiar referableice coercion each (ie. “Please intermissionraintm in the rise”). a. Celerity – The urge (in feet per cooperate) at which the cannonball is fired. b. Turn – The turn (in degrees) balance the foundation at which the cannonball is fired (this is denominated the tendency turn in the balance diagram). c. Interspace This is the spiritshort interspace (in feet) to the target (RH in the balance diagram) d. Rise – The rise (in feet) of the reasonwork of the target from the foundation (y rate on an x-y roll). e. Extent – This is how elevated the target is from its reasonwork (elevation) to its summit (rise + extent). Validate the interpretationr’s input. Undivided of the calculations you want to do requires disruption and we must fix that the denominator of the equation is referable 0. a. Calculate (celerity * the cosine of turn in radians). i. Interpretation the Math dispose coercion cosine and converting to radians. b. If that rate if 0, sculpture a referableice that the interspace canreferable be congenial with that input and do referable live. Otherwise, accept the program live to the direct tread. i. That is, the intermission of the program should be in an else obstruct. C. Calculate the occasion it takes the sight to arrive-at the interspace. a. The coercionmula is (distance/ (celerity * the cosine of turn in radians). d. Calculate the rise of the missile at the interspace. a. The coercionmula is (celerity *occasion *the evile of the turn in radians – ((32.17 * occasion squared)/2)) i. Again, interpretation the math dispose coercion the evile and squaring occasion. ii. If you’re having misery with this coercionmula, test infringement it into smaller faculty. Sculpture the fruit of this cannonball shot. a. There are lewd practicable fruits and you should sculpture a peculiar referableice coercion each undivided. i. Rise is short than 0: This resources that the cannonball did referable well-balanced arrive-at the target. ii. Rise is elder than 0 yet short than the rise of the target: This resources the cannonball went lower the target. Sculpture the rise of the cannonball as separate of your referableice. iii. Rise is elder than rise and short than rise plus extent: This resources the cannonball succeed the target! iv. Rise is elder than rise plus extent: The cannonball went balance the summit of the target. iv. Rise is elder than rise plus extent: The cannonball went balance the summit of the target.

    Expert Repartee

     

    import java.util.*;
    import java.lang.*;

    dispose Test
    {
    public static wanting main(String[]args)
    {
    Scanner view = newlightlight Viewner(System.in);

    wrap riseMissile = 0;

    //input variables

    System.out.println(“Please intermissionraintm in the celerity : “);
    wrap celerity = view.nextDouble();

    System.out.println(“Please intermissionraintm in the turn : “);
    wrap turn = view.nextDouble();

    System.out.println(“Please intermissionraintm in the interspace : “);
    wrap interspace = view.nextDouble();

    System.out.println(“Please intermissionraintm in the rise : “);
    wrap rise = view.nextDouble();

    System.out.println(“Please intermissionraintm in the extent : “);
    wrap extent = view.nextDouble();

    //check denominator stipulation coercion 0 rate
    if(celerity * Math.toRadians(Math.cos(angle)) == 0)
    System.out.println(“Interspace canreferable be congenial “);
    else
    {

    wrap occasion = interspace/(celerity * Math.toRadians(Math.cos(angle))) ;

    heightMissile = celerity * occasion * (Math.toRadians(Math.sin(angle))) -(32.17*time*time/2);

    }

    if(heightMissile < 0)
    System.out.println(“Cannonball did referable well-balanced arrive-at the target.”);

    else if(heightMissile > 0 && riseMissile < rise)
    System.out.println(“Cannonball went lower the target.Rise : “+heightProjectile);

    else if(heightMissile > rise && riseMissile <(elevation+size))
    System.out.println(“Cannonball succeed the target.”);

    else if(heightMissile >(rise + extent))
    System.out.println(“Cannonball went balance the summit of the target . Rise : “+heightProjectile);
    }
    }