Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Fructe {
- boolean seminte;
- boolean anotimp;
- float p;
- void setProprietati(boolean seminte, boolean anotimp) {
- this.seminte=seminte;
- this.anotimp=anotimp;
- this.p= (float) 25;
- }
- void Afiseaza_Proprietati() {
- if (seminte) {
- System.out.println("Fructul dat are seminte");
- } else {
- System.out.println("Fructul dat nu are seminte");
- }
- if (anotimp) {
- System.out.println("Fructul dat este sezonier");
- } else {
- System.out.println("Fructul dat nu este sezonier");
- }
- System.out.println("Pretul " +p);
- }
- }
- public class Prob3 {
- public static void main (String [] args ) {
- Fructe f = new Fructe();
- f.setProprietati(true, false);
- f.Afiseaza_Proprietati();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement