daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Delavec.java:
  2.  
  3. public class Delavec
  4. {
  5.     private String Ime;
  6.     private String Priimek;
  7.     private int Placa;
  8.    
  9.     Delavec (String name, String lname, int pay)
  10.     {
  11.         Ime = name;
  12.         Priimek = lname;
  13.         Placa = pay;
  14.     }
  15.    
  16.     public void SetIme (String a)
  17.     {
  18.         Ime = a;
  19.     }
  20.    
  21.     public void SetPriimek (String a)
  22.     {
  23.         Priimek = a;
  24.     }
  25.    
  26.     public void SetPlaca (int a)
  27.     {
  28.         if(a > 0)
  29.             Placa = a;
  30.     }
  31.    
  32.     public String GetIme ()
  33.     {
  34.         return Ime;
  35.     }
  36.    
  37.     public String GetPriimek ()
  38.     {
  39.         return Priimek;
  40.     }
  41.    
  42.     public int GetPlaca ()
  43.     {
  44.         return Placa;
  45.     }
  46. }
  47.  
  48.  
  49. DelavecTest.java:
  50.  
  51.  
  52.  
  53.  
  54. public class DelavecTest {
  55.  
  56.     public static void main(String[] args) {
  57.         Delavec no1 = new Delavec("Primož", "Kovačič", 12);
  58.         Delavec no2 = new Delavec("Mrjanež", "Baždaric", 13);
  59.        
  60.         System.out.println("Ime: " + no1.GetIme() + "\nPriimek:" + no1.GetPriimek() + "\nPlaca: " + no1.GetPlaca());
  61.         System.out.println("Ime: " + no2.GetIme() + "\nPriimek:" + no2.GetPriimek() + "\nPlaca: " + no2.GetPlaca());
  62.        
  63.         no1.SetPlaca(no1.GetPlaca() / 10 * 11);
  64.         no2.SetPlaca(no2.GetPlaca() / 10 * 11);
  65.        
  66.         System.out.println("Ime: " + no1.GetIme()+ "\nPriimek:"+ no1.GetPriimek()+ "\nPlaca: "+ no1.GetPlaca());
  67.         System.out.println("Ime: "+ no2.GetIme()+ "\nPriimek:"+ no2.GetPriimek()+ "\nPlaca: "+ no2.GetPlaca());
  68.        
  69.     }
  70. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top