how can i come up with a code in java that shows the number of apartments in a block, the number of blocks in the estate and AT the same time show the cost of renting an apartment the name of the tenant in the apartment and how i can use the get method to find the total rent and number of apartments and use add method to add a new block in the estate

Can you give me some code that we can work with?

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules

Post what you have done so far and someone will help you from there.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package APARTMENTS;


/**
 *
 * @author HELEN
 */
public class APARTMENTS {

    /**
     * @param args the command line arguments
     */
    int bedrooms;
     int rent; 
     int floors ;
     String ApartmentNum;
     String tenantname;
     public APARTMENTS(){
         rent=0;
        tenantname="";
        floors=0;
        bedrooms=0;
        ApartmentNum="";
     }
        public void setaDetails(int irent, String itenantname, int ifloor, int ibedrooms, String inumber){
        rent=irent;
        tenantname=itenantname;
        floors=ifloor;
        bedrooms=ibedrooms;
        ApartmentNum=inumber;
        }
        public int getAmount(){
        return rent;
    }
    public String getName(){
        return tenantname;
    }
    public int getfloor(){
        return floors;
    }
    public int getbedrooms(){
        return bedrooms;
    }
    public String getnumber(){
        return ApartmentNum;
    }


     }

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author 72611
 */
public class Apartmentblocks {
    int totalrent;
    String blockname;
    int no_of_floors;
    int no_of_apartments;
    public Apartmentblocks(){
        totalrent=0;
        blockname="";
        no_of_floors=0;
        no_of_apartments=0;
}
    public void setthedetails(int yrent,String xblockname,int zfloors,int bapartments){
        totalrent=yrent;
        blockname=xblockname;
        no_of_floors=zfloors;
        no_of_apartments=bapartments;
    }
    public int getNumApartments(){
        return no_of_apartments;
    }
    public int getTotalRent(){
        return totalrent;
    }
    public String getTheblockname(){
        return blockname;
    }
   public int getNoFloors(){
       return no_of_floors;
   }  
}

public class Estate {
     String Nameof_estate;
    String estate_location;
    public Estate(){
        estate_location="";
        Nameof_estate="";
    }
    public void setmyDetails(String theestate, String thelocation){
        Nameof_estate=theestate;
        estate_location=thelocation;
}
    public String getLocation(){
        return estate_location;
}
    public String getestate(){
        return Nameof_estate;
}    
}


public class Cat1 {
    public static void main(String[]args){
    Estate y=new Estate(); 

    y.setmyDetails("CIVIL SERVANTS","NAIROBI WEST");
    Apartmentblocks purity=new Apartmentblocks();
    purity.setthedetails (100000,"KIFARU",6,15);
    purity.setthedetails (150000,"SUNGURA",2,6);
    purity.setthedetails (350000,"CRESCENT",5,11);


    APARTMENTS xyz=new APARTMENTS();
    xyz.setaDetails(15000,"PURITY MONJE",2,3,"BCM");
    System.out.println("This is"+" "+y.getestate()+" "+"estate and it is located in"+" "+y.getLocation());
       System.out.println("The total rent of this block is"+""+purity.getTotalRent()+"and the block is called"+""+purity.getTheblockname()+"."+"It has"+purity.getNoFloors()+"floors"+""+"and"+"it has"+purity.getNumApartments()+"apartments"); 
    System.out.println("The total rent of this block is"+""+purity.getTotalRent()+"and the block is called"+" "+purity.getTheblockname()+"."+"It has"+purity.getNoFloors()+"floors"+""+"and"+"it has"+purity.getNumApartments()+"apartments");
        System.out.println("One of its tenants is Miss"+" "+xyz.getName()+" "+"who lives in house number"+" "+xyz.getnumber()+" "+"which is a"+xyz.getbedrooms()+""+"bedroomed house in the"+" "+xyz.getfloor()+" "+"floor"); 

} 
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author 72611
 */
public class APARTMENTS {
    int bedrooms;
     int rent; 
     int floors ;
     String ApartmentNum;
     String tenantname;
     public APARTMENTS(){
         rent=0;
        tenantname="";
        floors=0;
        bedrooms=0;
        ApartmentNum="";
     }
        public void setaDetails(int irent, String itenantname, int ifloor, int ibedrooms, String inumber){
        rent=irent;
        tenantname=itenantname;
        floors=ifloor;
        bedrooms=ibedrooms;
        ApartmentNum=inumber;
        }
        public int getAmount(){
        return rent;
    }
    public String getName(){
        return tenantname;
    }
    public int getfloor(){
        return floors;
    }
    public int getbedrooms(){
        return bedrooms;
    }
    public String getnumber(){
        return ApartmentNum;
    }
}


 THE DETAILS ARE AS FOLLOWS:
 THE classes apartmentblock and estate are classes within the class apartments.the main function is executed in the class cat1. how do i add  a new apartmentblock to the estate and how do i use arrays in the code

In your Estate class you can declare and initialise a simple array of ApartmentBlocks. Then you can have a public method that takes an ApartmentBlock as a parameter and puts it into the array. It's not hard, so just have a go and see how you get on.

after creating the array inside the estste how do i use the add method to add a new apartment block

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.