Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.46 KB | None | 0 0
  1. /**************************
  2.  * 2.Domácí úloha PPA1
  3.  *
  4.  * @author  Jan Janáček
  5.  * @version 1.00.0000
  6.  */
  7. package ppa1;
  8. /**************************
  9.  * importování lokace a vstupu
  10.  */
  11. import java.util.Locale;
  12. import java.util.Scanner;
  13. /**************************
  14.  * Trida programu
  15.  */
  16. public class Ppa1u02b {
  17.     public static Scanner sc;
  18.     /**************************
  19.      * Hlavni trida Main
  20.      */
  21.     public static void main(String[] args) {
  22.         sc = new Scanner(System.in);
  23.         System.out.print("Zadej Ax: ");
  24.         double Ax = sc.nextInt();
  25.         System.out.print("Zadej Ay: ");
  26.         double Ay = sc.nextInt();
  27.         System.out.print("Zadej Cx: ");
  28.         double Cx = sc.nextInt();
  29.         System.out.print("Zadej Cy: ");
  30.         double Cy = sc.nextInt();
  31.         double Sx = (Ax + Cx)/2;
  32.         double Sy = (Ay + Cy)/2;
  33.         double smer_vektor_X = Cx - Ax;
  34.         double smer_vektor_Y = Cy - Ay;
  35.         double normalX = (smer_vektor_X/2) + (-1);
  36.         double normalY = (smer_vektor_Y/2);
  37.  
  38.         double Bx = Sx + normalX;
  39.         double By = Sy + normalY;
  40.         double Dx = Sx + normalX * (-1);
  41.         double Dy = Sy + normalY + (-1);
  42. /**************************
  43.  * Výpis
  44.  */
  45.         System.out.format(Locale.US,"Bx %.3f \n",Bx);
  46.         System.out.format(Locale.US,"By %.3f \n",By);
  47.         System.out.format(Locale.US,"Dx %.3f \n",Dx);
  48.         System.out.format(Locale.US,"Dy %.3f \n",Dy);
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement