- import java.util.Collections;
- import java.util.Vector;
- public class K2 {
- public static void main(String[] args) {
- // loon uued vektorid x ja y jaoks. PS. vektor andmekogum mille pikkust ei pea m22rama.
- Vector<Double> vx = new Vector<Double>();
- Vector<Double> vy = new Vector<Double>();
- double t=10.0, samm=0.0125, x, y;
- while (t > -10.0){
- x = 100.0 * Math.sin(t * Math.PI / 2.0) * Math.cos(t * Math.PI / 10.0);
- y = 100.0 * Math.sin(t * Math.PI / 2.0) * Math.sin(t * Math.PI / 10.0);
- t = t-samm; // arvutab t uue v22rtuse.
- samm = samm * 1.01; // leiab uue sammu.
- vx.add(x); // lisan tulemuse vx vektorisse.
- vy.add(y); // lisan tulemuse vy vektorisse.
- }
- //sorteerin vektorid
- Collections.sort(vx);
- Collections.sort(vy);
- System.out.print("x: "); // v2ljastan p2ise,
- System.out.println(vx + " "); // v2ljastan sorteeritud vektori.
- System.out.print("y: ");
- System.out.println(vy + " ");
- }
- }
Posted by sander_l on Wed 17th Jan 10:29 (modification of post by magel view diff)
diff | download | new post
Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.