CS in java code need help How to create a appocation to shoo

CS in java code need help!!! How to create a appocation to shoot projectiles

Solution

class projectile extends SwingWorker<Void, Void>
{
  
protected Void dOInBckgrnd() throws Exception
{
FileWriter fstream = new FileWriter(\"output.txt\");

BufferedWriter out = new BufferedWriter(fstream);

double angl = Double.valueOf(angleText.getText());
double rdins = angl * (Math.PI/180);
double vel = Double.valueOf(speedText.getText());
double mass = Double.valueOf(massText.getText());
double y = Double.valueOf(heightText.getText());
double x = 0;
double epX = Double.valueOf(epxText.getText());
double epY = Double.valueOf(epyText.getText());
double ax = Double.valueOf(accxText.getText());
double ay = Double.valueOf(accyText.getText());

int nuBncs = 0;
double deltaTime = .00000001;
double total_velocity = 0.0;
double time = 0.0;

String fs;

angl = angl * Math.PI / 180;

while(nuBncs < 10)
{
  
time = time + deltaTime;

  
double vx = (vel*Math.cos(angl)) + ax*time;;
double vy = (vel*Math.sin(angl)) + ay*time;

  
x = x + vx*time;
y = y + vy*time + .5*ay*(time*time);

System.out.format(\"%.3f\ \", y);

fs = String.format(\"%f\\t %f\\t %f\\t %f\\t %f\\t %f\\t %f\\t\ \", ax, ay, x, y, vx, vy, time);

out.write(fs);

  
if(y < 0)
{
nuBncs++;

System.out.println(\"Number of Bounces: \" + nuBncs);

  
vy = -vy - ay*time; // vy = -vy - ay*time;

angl = Math.atan(vy/vx);

angl = angl * Math.PI / 180;


total_velocity = Math.sqrt((vy*vy) + (vx*vx));

  
total_velocity = Math.sqrt((epY) * total_velocity);


vy = total_velocity*Math.sin(angl);
vx = total_velocity*Math.cos(angl);

out.write(fs);

}

  

  
}

out.close();

return null;
}

  
public void done()
{
try
{   

}

catch (Exception e)
{
e.printStackTrace();
}
}
}

CS in java code need help!!! How to create a appocation to shoot projectilesSolutionclass projectile extends SwingWorker<Void, Void> { protected Void dOIn
CS in java code need help!!! How to create a appocation to shoot projectilesSolutionclass projectile extends SwingWorker<Void, Void> { protected Void dOIn

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site