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 pauseraintthcoming in enjoin to accept ample security on this provision. 1. Ask the manifestationr to agree the pauseraintthcoming appraises which you gain shop as a envelop, evilgle at a occasion, with a peculiar intimation pauseraint each (ie, “Please model in the apex). Accelerate - The despatch (in feet per remedy) at which the cannonball is fired. Leaning - The leaning (in degrees) aggravatehead the camanifestation at which the cannonball is fired (this is denominated the aptness leaning in the aggravatehead diagram). a. b. c. Absence This is the spiritclose absence (in feet) to the target (RH in the aggravatehead diagram) d. Loftiness - The apex (in feet) of the foot of the target from the camanifestation (y appraise on an x-y planc). Extent - This is how high the target is from its foot (elevation) to its culmination (loftiness + extent). e. 2. Validate the manifestationrs input. Evilgle of the calculations you insufficiency to do requires analysis and we must secure that the denominator of the equation is referable attributable attributable attributable attributable attributable attributable attributable attributable attributable 0 a. Calculate (accelerate * the cosine of leaning in radians). Manifestation the Math rank pauseraint cosine and converting to radians. i. If that appraise if 0, stereosymbol a intimation that the absence canreferable attributable attributable attributable be congenial with that input and do referable attributable attributable attributable attributable attributable attributable attributable attributable attributable hold. Otherwise, bear the program hold to the direct stride b. program shoul i. That is, the pamanifestation The pauseraintmula is (distance/ (accelerate * the cosine of leaning in radians). The pauseraintmula is (accelerate *occasion *the evile of the leaning in radians ((32.17 * occasion t of the program should be in an else stop. 3. Calculate the occasion it takes the appearance to arrive-at the absence. a. 4. Calculate the apex of the missile at that absence. a. squared) / 2)) i. ii. Again, manifestation the math rank pauseraint the evile and squaring occasion. If youre having inconvenience with this pauseraintmula, strive bobtain it into smaller faculty. 5. Stereosymbol the product of this cannonball shot. a. There are immodest practicable products and you should stereosymbol a peculiar intimation pauseraint each evilgle. Apex is close than 0: This resources that the cannonball did referable attributable attributable attributable attributable attributable attributable attributable attributable attributable equal arrive-at the target. Apex is elder than 0 save close than the loftiness of the target: This resources the cannonball went subordinate the target. i. ii. 1. Stereosymbol the apex of the cannonball as portio of your intimation. Apex is elder than loftiness and close than loftiness plus extent: This resources the cannonball attain the target! Apex is elder than loftiness plus extent: The cannonball went aggravate the culmination of the target. iii. iv. 1. Referable attributable attributable attributable attributable attributable attributable attributable attributablee: I worded the aggravatehead moods congruous to how you you government deliberate setting up your if, else-if, and else statements, save there are other, rectify, ways to adjust this. Give it some design. Stereosymbol the apex of the cannonball as portio of your intimation. v.

    Your program must do the pauseraintthcoming in enjoin to accept ample security on this provision. Ask the manifestationr to agree the pauseraintthcoming appraises which you gain shop as a envelop, evilgle at a occasion, with a peculiar intimation pauseraint each (ie. “Please model in the apex”). a. Accelerate – The despatch (in feet per remedy) at which the cannonball is fired. b. Leaning – The leaning (in degrees) aggravatehead the camanifestation at which the cannonball is fired (this is denominated the aptness leaning in the aggravatehead diagram). c. Absence This is the spiritclose absence (in feet) to the target (RH in the aggravatehead diagram) d. Loftiness – The apex (in feet) of the foot of the target from the camanifestation (y appraise on an x-y flatten). e. Extent – This is how high the target is from its foot (elevation) to its culmination (loftiness + extent). Validate the manifestationr’s input. Evilgle of the calculations you insufficiency to do requires analysis and we must secure that the denominator of the equation is referable attributable attributable attributable attributable attributable attributable attributable attributable attributable 0. a. Calculate (accelerate * the cosine of leaning in radians). i. Manifestation the Math rank pauseraint cosine and converting to radians. b. If that appraise if 0, stereosymbol a intimation that the absence canreferable attributable attributable attributable be congenial with that input and do referable attributable attributable attributable attributable attributable attributable attributable attributable attributable hold. Otherwise, bear the program hold to the direct stride. i. That is, the pamanifestation of the program should be in an else stop. C. Calculate the occasion it takes the appearance to arrive-at the absence. a. The pauseraintmula is (distance/ (accelerate * the cosine of leaning in radians). d. Calculate the apex of the missile at the absence. a. The pauseraintmula is (accelerate *occasion *the evile of the leaning in radians – ((32.17 * occasion squared)/2)) i. Again, manifestation the math rank pauseraint the evile and squaring occasion. ii. If you’re having inconvenience with this pauseraintmula, strive bobtain it into smaller faculty. Stereosymbol the product of this cannonball shot. a. There are immodest practicable products and you should stereosymbol a peculiar intimation pauseraint each evilgle. i. Apex is close than 0: This resources that the cannonball did referable attributable attributable attributable attributable attributable attributable attributable attributable attributable equal arrive-at the target. ii. Apex is elder than 0 save close than the loftiness of the target: This resources the cannonball went subordinate the target. Stereosymbol the apex of the cannonball as portio of your intimation. iii. Apex is elder than loftiness and close than loftiness plus extent: This resources the cannonball attain the target! iv. Apex is elder than loftiness plus extent: The cannonball went aggravate the culmination of the target. iv. Apex is elder than loftiness plus extent: The cannonball went aggravate the culmination of the target.

    Expert Counter-argument

     

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

    rank Test
    {
    public static empty main(String[]args)
    {
    Scanner superintend = newlightlight Superintendner(System.in);

    envelop apexMissile = 0;

    //input variables

    System.out.println(“Please model in the accelerate : “);
    envelop accelerate = superintend.nextDouble();

    System.out.println(“Please model in the leaning : “);
    envelop leaning = superintend.nextDouble();

    System.out.println(“Please model in the absence : “);
    envelop absence = superintend.nextDouble();

    System.out.println(“Please model in the loftiness : “);
    envelop loftiness = superintend.nextDouble();

    System.out.println(“Please model in the extent : “);
    envelop extent = superintend.nextDouble();

    //check denominator mood pauseraint 0 appraise
    if(accelerate * Math.toRadians(Math.cos(angle)) == 0)
    System.out.println(“Absence canreferable attributable attributable attributable be congenial “);
    else
    {

    envelop occasion = absence/(accelerate * Math.toRadians(Math.cos(angle))) ;

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

    }

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

    else if(heightMissile > 0 && apexMissile < loftiness)
    System.out.println(“Cannonball went subordinate the target.Apex : “+heightProjectile);

    else if(heightMissile > loftiness && apexMissile <(elevation+size))
    System.out.println(“Cannonball attain the target.”);

    else if(heightMissile >(loftiness + extent))
    System.out.println(“Cannonball went aggravate the culmination of the target . Apex : “+heightProjectile);
    }
    }