Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**************************
- * 2.Domácí úloha PPA1
- *
- * @author Jan Janáček
- * @version 1.00.0000
- */
- package ppa1;
- /**************************
- * importování lokace a vstupu
- */
- import java.util.Locale;
- import java.util.Scanner;
- /**************************
- * Trida programu
- */
- public class Ppa1u02b {
- public static Scanner sc;
- /**************************
- * Hlavni trida Main
- */
- public static void main(String[] args) {
- sc = new Scanner(System.in);
- System.out.print("Zadej Ax: ");
- double Ax = sc.nextInt();
- System.out.print("Zadej Ay: ");
- double Ay = sc.nextInt();
- System.out.print("Zadej Cx: ");
- double Cx = sc.nextInt();
- System.out.print("Zadej Cy: ");
- double Cy = sc.nextInt();
- double Sx = (Ax + Cx)/2;
- double Sy = (Ay + Cy)/2;
- double smer_vektor_X = Cx - Ax;
- double smer_vektor_Y = Cy - Ay;
- double normalX = (smer_vektor_X/2) + (-1);
- double normalY = (smer_vektor_Y/2);
- double Bx = Sx + normalX;
- double By = Sy + normalY;
- double Dx = Sx + normalX * (-1);
- double Dy = Sy + normalY + (-1);
- /**************************
- * Výpis
- */
- System.out.format(Locale.US,"Bx %.3f \n",Bx);
- System.out.format(Locale.US,"By %.3f \n",By);
- System.out.format(Locale.US,"Dx %.3f \n",Dx);
- System.out.format(Locale.US,"Dy %.3f \n",Dy);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement