
public class MarriedPerson extends Person{
 private int children;

 
 public MarriedPerson(String lastname, String firstname, int age, float salary, int sex, int children){
     super(lastname, firstname, age, true, salary, sex);
     this.children=children;
    }
    
   
    public int getNoOfChildren(){return children;}
    
    public boolean setMarried(boolean mar){return super.setMarried(true);}
    
     public float setSalary(MarriedPerson spouse){
      
       if(super.sex != spouse.sex)
       super.salary=spouse.salary+super.salary;
      
       return super.salary;
       
            
    }
     
    
       
 void printInfo() {
     
     super.printInfo();
     System.out.print("with ");
     if(children>0)
     System.out.print(children );
     else System.out.print("no ");
     System.out.println(" children");
   

    }
}