
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.
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);
}
}