Advertisement
mp3shyn

Untitled

Apr 4th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. public class Zad3 {
  2.     void wczytanie() {
  3.         Scanner sc = new Scanner(System.in);
  4.  
  5.         System.out.println("podaj A - liczbe calkowita ");
  6.         double a = sc.nextDouble();
  7.         System.out.println("podaj B - liczbe calkowita ");
  8.         double b = sc.nextDouble();
  9.         new Zad3().sprawdzenie(a, b);
  10.         new Zad3().jakiMaZnak(a,b);
  11.     }
  12.  
  13.     void sprawdzenie(double a, double b) {
  14.         if (a < b) {
  15.             System.out.println("liczba B jest większa od A");
  16.         }
  17.         else if (b > a) {
  18.             System.out.println("liczba A jest wieksza od B");
  19.         }
  20.         else {
  21.             System.out.println("liczby są równe");
  22.             }
  23.         }
  24.         void jakiMaZnak(double a, double b){
  25.             if (b < 0 || a<0) {
  26.                 System.out.println("liczba jest ujemna");
  27.             }else {
  28.                 System.out.println("liczba jest dodatnia");
  29.             }
  30.  
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement