Extended Class - Cannot Find Symbol
The class MP models projectile motion. Using the defined gravField in the GV class and also a defined time interval, the acceleration is calculated, then from this the velocity and position of the particle at different time intervals. Hopefully that makes sense :) . The program works fine, but now I need to add the class P which inherits from MP and is used to add the property of drag/air resistance to the particle motion.
This is the current code in MP:
Code:
public void updateProperties(GF gravField, MP particle, String request)
{
PV accelMultByTime = new PV(3);
accelMultByTime = gravField.accelDueToGravity(particle, request);
accelMultByTime.scaleBy(deltaTime);
velocityVector.increaseBy(accelMultByTime);
PV velocityMultByTime = new PV(3);
velocityMultByTime = velocityVector.scaleByReturnVector(deltaTime);
positionVector.increaseBy(velocityMultByTime);
return;
}
What I thought is that I could just slightly adjust this, so that the acceleration in MP is send to P, where the drag is defined and subtracted from the acceleration, producing a new set of velocity/position values. Again I hope that makes sense :) .
Code:
// method to factor in drag
public class P extends MP
{
// private class variables
private double dragCoeff;
// public class variables
public MP velocityMultByTime;
public void updateProperties(MP particle, String request)
{
PV velMultByTimeWDrag = new PV(3);
velMultByTimeWDrag = velocityMultByTime.decreaseBy(dragCoeff);
positionVector.increaseBy(velMultByTimeWDrag);
return;
}
However that gives me this error:
P.java:107: cannot find symbol
symbol : method decreaseBy(double)
location: class MP
velMultByTimeWDrag = velocityMultByTime.decreaseBy(dragCoeff);
^
1 error