Jump to content

any One can help me with this Project ?

- - - - -

  • Please log in to reply
6 replies to this topic

#1
Mrs

Mrs

    Newbie

  • Members
  • Pip
  • 4 posts

Hiiiz all :)

i'm a new member in ur gr8 forum ! and Promise to be an active one too , =D

I do need a help in this project , actually i'm just a beginner in Java , i just took : if statements , switch , arrays , loops , polymorphic and relations ( abstract , inheritance and interface ) ....

DO NOT solve it ! I'll but i need a help to at least start in it !

so anyone can help ?


it's here : Project CPCS 203.docx - 4shared.com - online file sharing and storage - download
click on the blue box in it ... تنزيل الأن

sorry if what i said above is not totally clear but English is not my native language ;)

thanks in advance =D


best Regards,
Mrs. ;)



#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
This is how I would do the classes:
Attached File  school.PNG   35.46K   41 downloads

The left half is what you minimally need.
The right half is optional to the left's school design.

Optionally you can do the same for teacher, employee and student.
By turning all 3 into separate classes, and making them extend a class "Person" or so.

Edit: Sorry, forgot you don't know List<> yet, just change that into an array then.

Edited by wim DC, 21 May 2011 - 12:33 AM.


#3
Mrs

Mrs

    Newbie

  • Members
  • Pip
  • 4 posts
hii again :)

Thanks alooot for the help :) I truly appreciated it !

here is what i just did :


public class SchoolGroup {


    private int adminEmpNum;

    private int teachersNum;

    private int studentsNum;

    private String SchoolType;

    private Region rigion = new Region();


    public void SchoolGroup() {

        this.SchoolType = null;

        this.adminEmpNum = 0;

        this.studentsNum = 0;

        this.teachersNum = 0;


    }


    public void SchoolGroup(String SchoolType, int adminEmpNum, int studentsNum, int teachersNum) {

        this.SchoolType = SchoolType;

        this.adminEmpNum = adminEmpNum;

        this.studentsNum = studentsNum;

        this.teachersNum = teachersNum;


    }

}








/*


 */


public class District {


    private String regions[] = {};

    private String name;


    public void District() {

        this.name = null;

        this.regions = new String[13];

    }


    public void District(String name) {

        this.name = name;

        this.regions = new String[13];

    }

}




public class Region {


    private String name;

    private String schoolGroup[] = {};


    public void Region() {


        this.name = null;

        this.schoolGroup = null;

    }


    public void Region(String name, String schoolGroup) {

        this.name = name;

        this.schoolGroup = new String[3];


    }

}



I'll make the School class and extend the 3 classes from it and also for Person but let's make it as simple as we can for now :)

where should I write the initial value exactly ? anything wrong with the code above ?

I didn't under stand what u mean by number 1 and the opposite U !

Extremely sorry for bothering :$ !


thanks as big as the earth :)


Best Regards ,

#4
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java

Quote

the opposite U
That's an "n" :P
In the diagram I made
District 1------n Region
the 1-n gives info about the relation. If this were a true UML diagram, I wouldn't have put the List<Region> there in the District class.
Because, as there is a line between the 2 classes, and there are 'n' regions for every '1' district, it should already be clear that district will have an array or some kind of collection of Regions (and 1 region has 1 district).

Quote

where should I write the initial value exactly ?
Well, since the data isn't coming from a structured file or database, I guess you should just write a main method somewhere (or in a separate class) and initialize everything in there:

District dist = new District("Makkah");

Region region1 = new Region("Makkah");

SchoolGroup secondary = new SchoolGroup("secondary", 100, 400, 13000);

region1.addSchoolGroup(secondary);


..other schoolgroups..


dist.addRegion(region1);;


...other regions..



Quote

anything wrong with the code above ?

public class SchoolGroup {


    private int adminEmpNum;

    private int teachersNum;

    private int studentsNum;

    private String [B][SIZE="5"]S[/SIZE][/B]choolType;

    private Region r[B][SIZE="5"]i[/SIZE][/B]gion[strike] = new Region()[/strike];


    public void SchoolGroup() {

[B]        this.SchoolType = null;

        this.adminEmpNum = 0;

        this.studentsNum = 0;

        this.teachersNum = 0;[/B]

    }


    public void SchoolGroup(String SchoolType, int adminEmpNum, int studentsNum, int teachersNum) {

        this.SchoolType = SchoolType;

        this.adminEmpNum = adminEmpNum;

        this.studentsNum = studentsNum;

        this.teachersNum = teachersNum;


    }

}

  • Variables shouldn't start with a capital letter.
  • Typo, and better don't set the region to a new region. You want to have control over which region is placed there,
    so don't let Java just create a new one. But use a setter to put the correct one in there.
  • The bold part in the constructor isn't wrong, but is unnecessary. An int by default is already 0. And an unassigned String is null by default as well.
    It's up to you if you leave it there or not. It could be more clear to you, just want to let you know it's not needed.


public class District {


    private [B][SIZE="5"]String [/SIZE][/B]regions[] = {};

    private String name;


    public void District() {

        [B]this.name = null;[/B]

        this.regions = new String[13];

    }


    public void District(String name) {

        this.name = name;

        this.regions = new String[13];

    }

}

  • You don't want an array of Strings as regions, you want the Region class.
  • Again like the previous part of code, the bold part in the constructor is not needed.
  • I notice you do this.regions = new String[13] 2 times. 1time per constructor, you can decide to call the first constructor from the 2nd.
    
        public void District() {        
    
            this.regions = new String[13];
    
        }
    
    
        public void District(String name) {
    
            this();
    
            this.name = name;
    
        }
    
    
    By using "this();" I'm calling the other constructor, and it will do "this.regions = new String[13];" there.
    This "constructor chaining" prevents you from having to write the same thing multiple times. In this case it's only 1 line, so the code isn't shorter nor longer.
    But if there were more, this "strategy" would become more and more appealing.


public class Region {


    private String name;

    private [SIZE="5"]String [/SIZE]schoolGroup[] = {};


    public void Region() {

        [B]this.name = null;[/B]

        this.schoolGroup = null;

    }


    public void Region(String name, String schoolGroup) {

        this.name = name;

        this.schoolGroup = new String[3];


    }

}

  • Like the previous part, you don't want String, but SchoolGroup class there.
  • The bold part is, again, not needed.
  • Note that, unlike the previous class, the no-arg constructor sets the schoolGroup array to null, while the other constructor to 3.
    This is not wrong. Just be sure that's how you wanted to do it, as in the previous class both arrays were created to a size of 13 in both constructors, and here 1 array is set to null.


#5
Mrs

Mrs

    Newbie

  • Members
  • Pip
  • 4 posts
WooooooW !! that help me toooo much !

i'll write the code and back =D


brb ;)

#6
Mrs

Mrs

    Newbie

  • Members
  • Pip
  • 4 posts
i know i'm tooooooooo late !! sorry for that ,

this is what i have done , now i just need to write the implement to the functions !


public class District {

// variable for District Name ...


    private String DistrictName;

// an array with an initail value for makkah district

    private Region MakkahDistrictRegions[] = new Region[3];


    // zero argument constructor

    District() {

        this.DistrictName = null;

        Region MakkahDistrictRegions[] = {new Region("Makkah", new District("Makkah"))

                                         , new Region("Jeddah", new District("Makkah"))

                                         , new Region("Taif", new District("Makkah"))};

    }

// constructor with argument


    District(String DistrictName) {

        this.DistrictName = DistrictName;

    }


// set function for the District Name

    public void setDistrictName() {

        this.DistrictName = DistrictName;

    }

// geta function for the District Name


    public String getDistrictName() {

        return DistrictName;

    }


    // get for the array

    public Region[] getMakkahDistrictRegions ()

    {


        return MakkahDistrictRegions ;

    }

}





public class Region {

// variable for the region Name 


    private String RegionName;

    private District District;


    private SchoolGroup[] MakkahSchool;

    private SchoolGroup[] JeddahSchool;

    private SchoolGroup[] TaifSchool;

// Zero argument Constrctor

    Region() {

        this.RegionName = null;

        MakkahSchool = new SchoolGroup[3];

        // for Makkah region...

        MakkahSchool[0] = new SchoolGroup("Primary School",50, 100, 400, 13000);

        MakkahSchool[1] = new SchoolGroup("Intermediate School",35, 80, 400, 12000);

        MakkahSchool[2] = new SchoolGroup("High School",30, 90, 450, 10000);

        

       

        // for Jeddah region...


        JeddahSchool = new SchoolGroup [3];

        JeddahSchool[0]= new SchoolGroup ("Primary School",100, 500, 1000, 40000);

        JeddahSchool[1]= new SchoolGroup("Intermediate School",87, 700, 3000, 35000);

        JeddahSchool[2]= new SchoolGroup ("High School",78, 7000, 5000, 33000); 


        // and for Taif Regigon .... 


        TaifSchool = new SchoolGroup [3];

        TaifSchool[0]= new SchoolGroup("Primary School",50, 100, 400, 13000);

        TaifSchool[1]= new SchoolGroup("Intermediate School",45, 200, 2000, 15000);

        TaifSchool[2]=  new SchoolGroup("High School",32, 400, 3000, 13000);      

    }


   

    

// constructor with argument


    Region(String RegionName, District district) {

        this.RegionName = RegionName;

        this.District = district;

    }

// set function for the region name


    public void setName() {

        this.RegionName = RegionName;

        this.District = District;

    }


    // get function for makkah schools array

    public SchoolGroup[] getMakkahSchools ()

    {

        return MakkahSchool;

    }

 // get function for Jeddah schools array

    public SchoolGroup[] getJeddahSchools ()

    {

        return JeddahSchool;

    }

 // get function for Taif schools array


    public SchoolGroup[] getTaifSchools()

    {

        return TaifSchool;

    }

// get functions for the reagion name 


    public String getRegionName() {

        return RegionName;

    }

}





public class SchoolGroup {

// Protected variables with type intger " protected b-coz i may need to inhert this classs "


    protected String schoolType ;

    protected int adminEmpNum;

    protected int teachersNum;

    protected int studentsNum;

    protected int numOfSchools;


    SchoolGroup() {// Zero argument constructor

        this.schoolType = null;

        this.adminEmpNum = 0;

        this.numOfSchools= 0;

        this.studentsNum = 0;

        this.teachersNum = 0;


    }

// constructor with argument


    SchoolGroup(String schoolType ,int numOfSchool, int adminmpNum, int teachersNum, int studentsNum) {

        this.schoolType = schoolType;

        this.numOfSchools = numOfSchool;

        this.adminEmpNum = adminmpNum;

        this.teachersNum = teachersNum;

        this.studentsNum = studentsNum;

    }

// seter function for all the variables


    public void setInfo() {

        this.schoolType = schoolType;

        this.teachersNum = teachersNum;

        this.numOfSchools = numOfSchools;

        this.adminEmpNum = adminEmpNum;

        this.studentsNum = studentsNum;

    }

// get the administration employees number function


    public String getSchoolType ()

    {

        return schoolType ;

    }


    public int getAdminEmpNum() {

        return adminEmpNum;

    }

// get the teachers number function


    public int getTeachersNum() {

        return teachersNum;

    }

// get the student number function


    public int getStudentsNum() {


        return studentsNum;


    }

// get the  number of schools function


    public int getNumOfSchools() {

        return numOfSchools;

    }

}





/**/



import java.util.*;


public class MinsteryOfEducation {


    District DistrictList[] = new District[13];

    Scanner input = new Scanner(System.in);


    MinsteryOfEducation() {

// an arry with type District ' which is a class ' has all kas districts

        District DistrictList[] = {new District("Makkah")

                , new District("Maddinah")

                , new District("Al Riyadh")

                , new District("Al Bahah")

                , new District("Jizan")

                , new District("Najran")

                , new District("Tabuk")

                , new District("Eastern Province")

                , new District("Asir")

                , new District("Ha'il")

                , new District("Al Qasim")

                , new District("Al Jawf")

                , new District("Northern Border")};

    }


    // The functions ::


    //Given the district, list the number of schools in that region, according to District Name.

    public void NumOfSchoolInRegions() {

        // ask the user about which district he/she wants to know about

        System.out.println("Enter the District Name :");

        String DistrictN = input.nextLine();// get whatever the user input


        // a exception should be here , dealing with a user !

    

    }



    //Given the district, region, list the number of schools in that region, according to District Name.

    public void NumberOfSchoolsInRegion() {

        System.out.println("Enter the District Name :");

        String districtN = input.nextLine();

        System.out.println("Enter the Region Name :");

        String regionN = input.nextLine();





    }


    //Given the district, list the number of schools in secondary or intermediate or high schools

    public void NumberOfSpecificTypeOfSchoolsInDistrcit() {

        System.out.println("Enter the District Name :");

        String districtN = input.nextLine();


    }


    //Given the district, region, list the number of schools in secondary or intermediate or high schools.

    public void NumberOfOneTypeOfSchoolsInOneRgion() {

        System.out.println("Enter the District Name :");

        String districtN = input.nextLine();

        System.out.println("Enter the Region Name :");

        String regionN = input.nextLine();

    }


    //Given the district, display the total number of schools.

    public void TotalNumberOfSchoolsInDisetrict() {

        System.out.println("Enter the District Name :");

        String districtN = input.nextLine();


    }


    // Given the district, region, display the total number of schools.

    public void TotalNumberOfSchoolsInRegion() {

        System.out.println("Enter the District Name :");

        String districtN = input.nextLine();


        System.out.println("Enter the Region Name :");

        String regionN = input.nextLine();


    }


    //Given the district, list the number of admin employees, teachers and students, according to District Name

    public void NumberOfPPLInEachTypeOfSchoolsInEachRegion() {

    }


    //Given the district, list the number of admin employees or teachers or students

    public void NumberOfOneKindOFpplInDistrict() {


        System.out.println("Enter the District Name :");

        String districtN = input.nextLine();

    }

    //Given the district, region, list the number of admin employees or teachers or students


    public void NumberOfOneKindOFpplInRegion() {

        System.out.println("Enter the District Name :");

        String districtN = input.nextLine();


        System.out.println("Enter the Region Name :");

        String regionN = input.nextLine();

    }

    // Given the district, region, school level, list the number of admin employees, teachers and students, according to D and R



    public void NumberOfPPLInOneSchoolLevelInRegion() {

        System.out.println("Enter the District Name :");

        String districtN = input.nextLine();


        System.out.println("Enter the Region Name :");

        String regionN = input.nextLine();


    }

    

}






import java.util.*;


public class main {


    public static void main(String[] args) {


       MinsteryOfEducation toCall = new MinsteryOfEducation();


        int answer = 0;

        Scanner input = new Scanner(System.in);

        ;

        while (answer != 11) {

           


            System.out.println("1.Given the district, list the number of schools in that region, according to District Name.");

            System.out.println("2.Given the district, region, list the number of schools in that region, according to District Name.");

            System.out.println("3.Given the district, list the number of schools in secondary or intermediate or high schools.");

            System.out.println("4.Given the district, region, list the number of schools in secondary or intermediate or high schools.");

            System.out.println("5.Given the district, display the total number of schools.");

            System.out.println("6.Given the district, region, display the total number of schools.");

            System.out.println("7.Given the district, list the number of admin employees, teachers and students, according to District Name.");

            System.out.println("8.Given the district, list the number of admin employees or teachers or students.");

            System.out.println("9.Given the district, region, list the number of admin employees or teachers or students.");

            System.out.println("10.Given the district, region, school level, list the number of admin employees, teachers and students, according to D ,R");

            System.out.println("11. Exit");


            System.out.println("What Do you want to do ,enter a number ");

            answer = input.nextInt();

             // exception shuold be here 



            switch (answer) {


                case 1:

                    toCall.NumOfSchoolInRegions();

                case 2:

                    toCall.NumberOfSchoolsInRegion();

                case 3:

                    toCall.NumberOfSpecificTypeOfSchoolsInDistrcit();

                case 4:

                    toCall.NumberOfOneTypeOfSchoolsInOneRgion();

                case 5:

                    toCall.TotalNumberOfSchoolsInDisetrict();

                case 6:

                    toCall.TotalNumberOfSchoolsInRegion();

                case 7:

                    toCall.NumberOfPPLInEachTypeOfSchoolsInEachRegion();

                case 8:

                    toCall.NumberOfOneKindOFpplInDistrict();

                case 9:

                    toCall.NumberOfOneKindOFpplInRegion();

                case 10:

                    toCall.NumberOfPPLInOneSchoolLevelInRegion();

                default:

                    System.out.println("Sorry , wrong choic^^;");


            }

        }

    }

}



what each implement should have ? it's in the docx file above :)


it's more than ok for me if you implement few functions like 2 -3 and I do the rest
i just want to know how to implement it :)


thanks alot and a lot

:)


Regards ,
Mrs.

#7
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
Let's talk about the searching later because you got a small problem which needs to be fixed first: The way you create the districts in the MinistryOfEduction class.
[B][COLOR="#000080"]new[/COLOR][/B] District([B][COLOR="#008000"]"Makkah"[/COLOR][/B])
This will lead to:
District(String DistrictName) {

    [B][COLOR="#000080"]this[/COLOR][/B].DistrictName = DistrictName;

}
And not to
District() {

   [B][COLOR="#000080"]this[/COLOR][/B].DistrictName = null;

   Region MakkahDistrictRegions[] = {[B][COLOR="#000080"]new[/COLOR][/B] Region([B][COLOR="#008000"]"Makkah"[/COLOR][/B], [B][COLOR="#000080"]new[/COLOR][/B] District([B][COLOR="#008000"]"Makkah"[/COLOR][/B]))

                                    , [B][COLOR="#000080"]new[/COLOR][/B] Region([B][COLOR="#008000"]"Jeddah"[/COLOR][/B], [B][COLOR="#000080"]new[/COLOR][/B] District([B][COLOR="#008000"]"Makkah"[/COLOR][/B]))

                                    , [B][COLOR="#000080"]new[/COLOR][/B] Region([B][COLOR="#008000"]"Ta[B][COLOR="#000080"]if[/COLOR][/B]"[/COLOR][/B], [B][COLOR="#000080"]new[/COLOR][/B] District([B][COLOR="#008000"]"Makkah"[/COLOR][/B]))};

    }
Which means the districts you create don't have Regions in them, and searching is pretty useless then.
And the same happens with the creating of Regions there. They won't contain any SchoolGroups.

Now, you COULD do the following:
District(String DistrictName) {

    [B][COLOR="#000080"]this[/COLOR][/B]();

    [B][COLOR="#000080"]this[/COLOR][/B].DistrictName = DistrictName;

}
The "this();" will call the no-arg constructor, and all the regions will get created.
Problem is it's a bit weird because all districts you create will the same as they contain the same regions. I'm not sure that's intended.

I noticed you did this:
Region() {

        [B][COLOR="#000080"]this[/COLOR][/B].RegionName = null;

        MakkahSchool = [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup[3];

        // [B][COLOR="#000080"]for[/COLOR][/B] Makkah region...

        MakkahSchool[0] = [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup([B][COLOR="#008000"]"Primary School"[/COLOR][/B],50, 100, 400, 13000);

        MakkahSchool[1] = [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup([B][COLOR="#008000"]"Intermediate School"[/COLOR][/B],35, 80, 400, 12000);

        MakkahSchool[2] = [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup([B][COLOR="#008000"]"High School"[/COLOR][/B],30, 90, 450, 10000);

        

       

        // [B][COLOR="#000080"]for[/COLOR][/B] Jeddah region...


        JeddahSchool = [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup [3];

        JeddahSchool[0]= [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup ([B][COLOR="#008000"]"Primary School"[/COLOR][/B],100, 500, 1000, 40000);

        JeddahSchool[1]= [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup([B][COLOR="#008000"]"Intermediate School"[/COLOR][/B],87, 700, 3000, 35000);

        JeddahSchool[2]= [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup ([B][COLOR="#008000"]"High School"[/COLOR][/B],78, 7000, 5000, 33000); 


        // and [B][COLOR="#000080"]for[/COLOR][/B] Ta[B][COLOR="#000080"]if[/COLOR][/B] Regigon .... 


        Ta[B][COLOR="#000080"]if[/COLOR][/B]School = [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup [3];

        Ta[B][COLOR="#000080"]if[/COLOR][/B]School[0]= [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup([B][COLOR="#008000"]"Primary School"[/COLOR][/B],50, 100, 400, 13000);

        Ta[B][COLOR="#000080"]if[/COLOR][/B]School[1]= [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup([B][COLOR="#008000"]"Intermediate School"[/COLOR][/B],45, 200, 2000, 15000);

        Ta[B][COLOR="#000080"]if[/COLOR][/B]School[2]=  [B][COLOR="#000080"]new[/COLOR][/B] SchoolGroup([B][COLOR="#008000"]"High School"[/COLOR][/B],32, 400, 3000, 13000);      

    }
Which creates all the schools, for every type of region even though you'll only need 1 type.
A clean way to fix this is using static methods to create Regions rather than using the constructor. In fact, the constructor can now even be private.

Small example with Strings:
[B][COLOR="#000080"]public[/COLOR][/B] [B][COLOR="#000080"]class[/COLOR][/B] Region {

    [B][COLOR="#000080"]private[/COLOR][/B] String name;

    [B][COLOR="#000080"]private[/COLOR][/B] String[] schoolNames;


    [B][B][COLOR="#000080"]private[/COLOR][/B] [/B]Region(String name, String[] schoolNames) {

        [B][COLOR="#000080"]this[/COLOR][/B].name = name;

        [B][COLOR="#000080"]this[/COLOR][/B].schoolNames = schoolNames;

    }


    [B][COLOR="#000080"]public[/COLOR][/B] [B][B][COLOR="#000080"]static[/COLOR][/B] [/B]Region createMakkahRegion() {

       [B][COLOR="#000080"]return[/COLOR][/B] [B][COLOR="#000080"]new[/COLOR][/B] Region([B][COLOR="#008000"]"Makkah"[/COLOR][/B], [B][COLOR="#000080"]new[/COLOR][/B] String[]{[B][COLOR="#008000"]"Makkah Primary"[/COLOR][/B], [B][COLOR="#008000"]"Makka Intermediate"[/COLOR][/B], [B][COLOR="#008000"]"Makka High"[/COLOR][/B]});

    }


    [B][COLOR="#000080"]public[/COLOR][/B] [B][B][COLOR="#000080"]static[/COLOR][/B] [/B]Region createJeddahRegion() {

       [B][COLOR="#000080"]return[/COLOR][/B] [B][COLOR="#000080"]new[/COLOR][/B] Region([B][COLOR="#008000"]"Jeddah"[/COLOR][/B], [B][COLOR="#000080"]new[/COLOR][/B] String[]{[B][COLOR="#008000"]"Jeddah Primary"[/COLOR][/B], [B][COLOR="#008000"]"Jeddah Intermediate"[/COLOR][/B], [B][COLOR="#008000"]"Jeddah High"[/COLOR][/B]});

    }

}
And a District constructor like
District(String DistrictName) {

    [B][COLOR="#000080"]this[/COLOR][/B].DistrictName = DistrictName;

   MakkahDistrictRegions[] = [B][COLOR="#000080"]new[/COLOR][/B] Region[] {Region.createMakkahRegion(), Region.createJeddahRegion(), Region.createTa[B][COLOR="#000080"]if[/COLOR][/B]Region()};

}
Or it can use the same strategy if you plan to have multiple types of districts with each different regions:
[B][COLOR="#000080"]public[/COLOR][/B] [B][COLOR="#000080"]class[/COLOR][/B] District {

  [B][COLOR="#000080"]private[/COLOR][/B] String districtName;

  [B][COLOR="#000080"]private[/COLOR][/B] Region[] regions;


  [B][COLOR="#000080"]private[/COLOR][/B] District(String districtName, Region[] regions){

    [B][COLOR="#000080"]this[/COLOR][/B].districtName = districtName;

    [B][COLOR="#000080"]this[/COLOR][/B].regions = regions;

  }


  [B][COLOR="#000080"]public[/COLOR][/B] [B][COLOR="#000080"]static[/COLOR][/B] District createMakkahDistrict(){

      [B][COLOR="#000080"]return[/COLOR][/B] [B][COLOR="#000080"]new[/COLOR][/B] District([B][COLOR="#008000"]"Makkah district"[/COLOR][/B],  [B][COLOR="#000080"]new[/COLOR][/B] Region[] {Region.createMakkahRegion(), Region.createJeddahRegion(), Region.createTa[B][COLOR="#000080"]if[/COLOR][/B]Region()} );

  }

}
District makkahDistrict = District.createMakkahDistrict();

Edited by wim DC, 10 June 2011 - 10:01 AM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users