Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package arrays;
- import java.util.Arrays;
- /**
- *
- * @author Eugeny
- */
- public class Main {
- private double[] x = new double[5];
- private double[] y = {2.4, 5.9, 1.3, -5};
- private double[] z = new double[]{2.5, 3.1, -2.4};
- public double getX(int i) {
- return x[i];
- }
- public void setX(double[] x) {
- this.x = x;
- }
- public void run() {
- // можно сделать и так
- // y = new double[]{3.5, 4};
- for (int i = 0; i < y.length; i++) {
- // System.out.println("z=" + z[i]);
- System.out.println("y=" + y[i]);
- // System.out.println("z=" + z[i]);
- }
- Arrays.sort(y);
- for (double d : y) {
- System.out.println("y="+d);
- }
- double s = 0;
- for (double d : y) {
- s+=d;
- }
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- new Main().run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement