Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package oefening1hfstk8;
- import java.util.Scanner;
- public class test {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner keyboard = new Scanner(System.in);
- int punt1x, punt1y, punt2x, punt2y;
- System.out.print("Punt 1 x : ");
- punt1x = keyboard.nextInt();
- System.out.print("Punt 1 y : ");
- punt1y = keyboard.nextInt();
- System.out.print("Punt 2 x : ");
- punt2x = keyboard.nextInt();
- System.out.print("Punt 2 y : ");
- punt2y = keyboard.nextInt();
- if (punt1y < punt2y) {
- for (int i = 2; i <= punt1y; i++) {
- System.out.println();
- for (int j = 2; j <= punt1x; j++) {
- System.out.print(" ");
- }
- }
- System.out.print("p");
- for (int i = 1; i <= punt2y - punt1y; i++) {
- System.out.println();
- for (int j = 2; j <= punt2x; j++) {
- System.out.print(" ");
- }
- }
- System.out.print("p2");
- } else if (punt2y < punt1y) {
- for (int i = 2; i <= punt2y; i++) {
- System.out.println();
- for (int j = 2; j <= punt2x; j++) {
- System.out.print(" ");
- }
- }
- System.out.print("p2");
- for (int i = 1; i <= punt1y - punt2y; i++) {
- System.out.println();
- for (int j = 2; j <= punt1x; j++) {
- System.out.print(" ");
- }
- }
- System.out.print("p");
- } else if (punt1x == punt2x && punt1y == punt2y) {
- for (int i = 2; i <= punt1y; i++) {
- System.out.println();
- for (int j = 2; j <= punt1x; j++) {
- System.out.print(" ");
- }
- }
- System.out.print("p");
- } else if (punt1y == punt2y) {
- for (int i = 2; i <= punt1y; i++) {
- System.out.println();
- for (int j = 2; j <= punt1x; j++) {
- System.out.print(" ");
- }
- }
- System.out.print("p");
- for (int i = 2; i <= punt2x - punt1x; i++) {
- System.out.print(" ");
- }
- System.out.print("p2");
- }
- keyboard.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement