0

forループでカウンターの特定の値をトラップするにはどうすればよいですか。これにより、計算された最大値が得られます..たとえば:

import com.imonPhysics.projectile2;

public class motion2{

public static void main(String[] args){

    double range=0,v=35,maxrange=0,angle=0;
    int x=0;
    projectile2 p1=new projectile2();
    System.out.println("the given velocity is:  20  m/s \n" );
    System.out.println("The value of g is: 9.8 m/s^2\n\n" );

    for(int j=0;j<=90;j+=5){
      x=j;
      range=p1.calculate(v,j);
      System.out.println("For the angle :" + j+" the range is: " + range);
      if(range > maxrange)maxrange=range;

    }    

    System.out.println(" the maximum range is :"+ maxrange);
    System.out.println(" the angle at which the range is max is :   " + angle);


}

}

maxrange の角度をトラップするにはどうすればよいですか。

4

2 に答える 2