Advertisement
Morogn93

Untitled

Oct 29th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. package Pesel;
  2. import java.util.*;
  3. public class WprowadzDane{
  4.     public static void main(String[] args) {
  5.         System.out.println("Wprowadz Dane: String Imie, String nazwisko, int pesel");
  6.         Scanner czytnik = new Scanner(System.in);
  7.         Osoba p1 = new Osoba(czytnik.nextLine(), czytnik.nextLine(),czytnik.nextInt());
  8.         System.out.println(p1.toString());
  9.        
  10.        
  11.     }
  12. }
  13.  
  14. class Osoba{
  15.     private String imie;
  16.     private String nazwisko;
  17.     private int pesel;
  18.     public Osoba(){
  19.        
  20.     }
  21.     public Osoba(String imie, String nazwisko, int pesel) {
  22.         this.imie = imie;
  23.         this.nazwisko = nazwisko;
  24.         this.pesel = pesel;
  25.     }
  26.     public String getImie() {
  27.         return imie;
  28.     }
  29.     public void setImie(String imie) {
  30.         this.imie = imie;
  31.     }
  32.     public String getNazwisko() {
  33.         return nazwisko;
  34.     }
  35.     public void setNazwisko(String nazwisko) {
  36.         this.nazwisko = nazwisko;
  37.     }
  38.     public int getPesel() {
  39.         return pesel;
  40.     }
  41.     public void setPesel(int pesel) {
  42.         this.pesel = pesel;
  43.     }
  44.     public String toString(){
  45.         return getImie()+" "+getNazwisko()+" "+getPesel();
  46.        
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement