Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class daneProstokata
- {
- int a,b;
- Scanner odczyt = new Scanner(System.in);
- void ustawBokA()
- {
- System.out.println("Podaj bok a");
- a = odczyt.nextInt();
- }
- void ustawBokB()
- {
- System.out.println("Podaj bok b");
- b = odczyt.nextInt();
- }
- int pobierzA()
- {return a;}
- int pobierzB()
- {return b;}
- int pole(int x, int y)
- {return x*y;}
- int obwod(int x, int y)
- {return (2*x)+(2*y);}
- }
- public class Prostakat
- {
- public static void main(String[] args)
- {
- daneProstokata fin = new daneProstokata();
- fin.ustawBokA();
- fin.ustawBokB();
- System.out.println("a= " + fin.pobierzA());
- System.out.println("b= " + fin.pobierzB());
- System.out.println("Pole= " + fin.pole(fin.pobierzA(),fin.pobierzB()));
- System.out.println("Pole= " + fin.obwod(fin.pobierzA(),fin.pobierzB()));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement