Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. class Fructe {
  2. boolean seminte;
  3. boolean anotimp;
  4. float p;
  5.  
  6. void setProprietati(boolean seminte, boolean anotimp) {
  7. this.seminte=seminte;
  8. this.anotimp=anotimp;
  9. this.p= (float) 25;
  10.  
  11. }
  12.  
  13. void Afiseaza_Proprietati() {
  14. if (seminte) {
  15. System.out.println("Fructul dat are seminte");
  16. } else {
  17. System.out.println("Fructul dat nu are seminte");
  18. }
  19.  
  20. if (anotimp) {
  21. System.out.println("Fructul dat este sezonier");
  22. } else {
  23. System.out.println("Fructul dat nu este sezonier");
  24. }
  25.  
  26. System.out.println("Pretul " +p);
  27. }
  28.  
  29.  
  30. }
  31.  
  32. public class Prob3 {
  33. public static void main (String [] args ) {
  34. Fructe f = new Fructe();
  35. f.setProprietati(true, false);
  36. f.Afiseaza_Proprietati();
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement