Advertisement
ZazoTazo

ODC

Nov 27th, 2019
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.50 KB | None | 0 0
  1. package com.company;
  2.  
  3. public class Main {
  4.  
  5.     static double a[] = new double[10];
  6.     static double b[] = new double[10];
  7.     static double ox[] = new double[10];
  8.     static double oy[] = new double[10];
  9.     static double xy[][] = new double[10][10];
  10.  
  11.     public static void main(String[] args) {
  12.         init();
  13.         calculation();
  14.     }
  15.  
  16.     public static void init(){
  17.         b[0] = 1;
  18.         b[1] = 1;
  19.         xy[0][0] = 200;
  20.         xy[0][1] = 700;
  21.         xy[1][0] = 300;
  22.         xy[1][1] = 100;
  23.         oy[0] = 1800;
  24.         oy[1] = 900;
  25.         ox[0] = 1100;
  26.         ox[1] = 1500;
  27.     }
  28.  
  29.     public static void GetAFactor(){
  30.         double dominator = 0;
  31.         for (int i = 0; i < 10; i++){
  32.             for (int j = 0; j < 10; j++){
  33.                 dominator += (xy[i][j] * b[j]);
  34.             }
  35.             a[i] = oy[i] / dominator;
  36.         }
  37.     }
  38.  
  39.     public static void GetBFactor(){
  40.         double dominator = 0;
  41.         for (int i = 0; i < 10; i++){
  42.             for (int j = 0; j < 10; j++){
  43.                 dominator += (xy[j][i] * a[j]);
  44.             }
  45.             b[i] = ox[i] / dominator;
  46.         }
  47. //        b[0] = ox[0] / ((xy[0][0] * a[0]) + (xy[1][0] * a[1]));
  48. //        b[1] = ox[1] / ((xy[0][1] * a[0]) + (xy[1][1] * a[1]));
  49.     }
  50.  
  51.     public static void calculation(){
  52.         for (int i = 0; i < 7; i++){
  53.             GetAFactor();
  54.             GetBFactor();
  55.         }
  56.  
  57.         System.out.println(a[0] + "," + a[1] + "," + b[0] + "," + b[1]);
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement