subject matter experts,
greetings I come here b'coz i got nothing left i thought i solved this but to no avail.
i cannot make it work,,

import java.util.*;
class Property 
{
   private String ID;
   private String description;
   private String location;
   private double weeklyRR;
   private char status ;
   private boolean visibility;
   
   public Property (String pID, String pDesc, String pLOc, double weeklyR )
   {   
	  ID = pID;
	  description = pDesc;
	  location = pLOc;
	  weeklyRR = weeklyR;	
	  status = 'A';
	  visibility = false;
   } 
   
   public String setID()            { return ID; }
   public String setDescription()   { return description; }
   public String setLocation()      { return location; }
   public double setWeeklyRR()      { return weeklyRR; }  
   public char setStatus()          { return status; }
   public boolean setVisibility()   { return visibility; } 
   
   
   public String getID()            { return ID; }
   public String getDescription()   { return description; }
   public String getLocation()      { return location; }
   public double getWeeklyRR()      { return weeklyRR; }
   public char getStatus()          { return status; }
   public boolean getVisibility()   { return visibility; } 
   
   
   public void addProperty(String pID, String pDesc, String pLOc,double weeklyR)
   {  
	  Scanner scan = new Scanner(System.in);
	  Property properties[] = new  Property[10];
	  int count = 6;	 	   
	  System.out.println("Enter ID");
	  String ID = scan.nextLine();
	  System.out.println("Enter Description");
	  String description = scan.nextLine();
	  System.out.println("Enter Location");
	  String location = scan.nextLine();
	  System.out.println("Enter weekly rental rate");
	  double weeklyRR = scan.nextDouble();	  
	  properties[count] = new Property("ID", "description", "location", 0.0);
	  count++;
   } 
   
   public boolean startRental (String tenantID, GregorianCalendar startDate)
   {
	   
	   return true;
   }
   
   public double terminateRental (GregorianCalendar endDate)
   {
	   double charges = weeklyRR ;
	   return charges;	   
   }  
   
   public void printPropertyDetails(String pID, String pDesc, String pLOc,double weeklyR)
   {
	   for (int count = 0; count <10 ; count++)
	        System.out.println("Property "+getID()+" "+getDescription()+" "+getLocation()
	        		           +" "+getWeeklyRR());  
   } 
   
   
}


import java.util.*;
public class Administration 
{
	 public static void Menu(){	 
		 System.out.println("Menu");
		 System.out.println("1. Add Properties to the system");
	     System.out.println("2. Enter Rental Agreement information (provide: prop ID, tenant ID, start Date)");
		 System.out.println("3. Terminate a Rental agreement (provide: prop ID, tenant ID, End Date)");
		 System.out.println("4. Search for Properties(based on weekly_rental_rate)");
		 System.out.println("5. List Properties(not visible to clients)");
		 System.out.println("6. List Properties (currently rented out)");
		 System.out.println("7. List Properties(available for rent)");
		 System.out.println("8. Display the details(1 property or all)");
		 System.out.println("9. Exit");	}		
	
	public static int getAnswer()
   {
	  int answer;
	  Scanner scan = new Scanner(System.in);
	  answer = scan.nextInt();
		
	  while ( answer < 1 || answer > 9 )
	  {
		 if ( answer  ==  9 )
			return answer;
		    			
		 System.out.println("Invalid entry Try again") ;
		 answer = scan.nextInt();			
	  }
	 return answer;	
	}
	
	public static void main(String[] args)
   {  
	   Property properties[] = new  Property[10];
	   int count = 0;	   
	   properties[count] = new Property("AP001", "2-bedroom apartment with city views", "Docklands", 550);  
	   count++;
	   properties[count] = new Property("UN112", "modern 3-bedroom unit", "Seddon", 465);
	   count++;
	   properties[count] = new Property("AP002", "older style 1-bedroom flat with gas cooking", "South Yarra", 310);
	   count++;
	   properties[count] = new Property("ED030", "renovated Edwardian with 4 bedrooms", "Camberwell", 650);
	   count++;
	   properties[count] = new Property("ED034", "original Edwardian with large backyard", "Moonee Ponds", 475);         
	   count++;
	   properties[count] = new Property("VT001", "single-fronted Victorian Terrace with 2 bedrooms and small courtyard"
				                        , "Brunswick", 465);	              
	   count++;
	   
	   int num;	
	   Menu();	     
	   num = getAnswer();			
	   while(num != 9)
	   {
		  if (num == 1)
			  properties .addProperty("ID", "description", "location", 0.0); 
		  else if (num == 2)
			       System.out.println("this is 2");	
		  else if (num == 3)
			       System.out.println("this is 3");
		  else if (num == 4)	
			       System.out.println("this is 4");
		  else if (num == 5)		  
			       System.out.println("this is 5");
		  else if (num == 6)
			      System.out.println("this is 6");
		  else if (num == 7)
			      System.out.println("this is 7");  
		  else if (num == 8)
			       properties .printPropertyDetails("ID", "description", "location", 0.0);   
			  
		  Menu();	   
		  num = getAnswer();		  
	   }
	  System.out.println("Exit");
	 }
	
	
}

i cannot make it work,,

What do you mean by you can't make it work? Can you compile it? If not, what's the error messages? And please post code using the CODE tags.

Also what is it supposed to do?

i'm trying to run Admin class using methods from Property class
i can't add property to the
Array , idon't know where to store the property array, i can't access the array.

it's an Array of Objects,, Property (String ID, String description, String loc,
double weekly rate)
do i store the array in property class or Admin class
i can't access it..
Thanx mate

Do you get any error messages when you compile or execute the code? Please copy and paste them here. See previous posts on this topic.

properties is an array. It doesn't have these methods:
printPropertyDetails, addProperty.
For printing loop the array and take each Property object from the array and print that.
As for adding you need to do what you do at the beginning of your program. You have the count variable. So add the next property there and increase it:

if (num == 1) {
  if (count<properties.length) {
    properties[count] = new Property("ID", "description", "location", 0.0);
    count++;
  } else {
    System.out.println("properties is full");
  }
}

thank you java addict..
is it alright to store my array of objects in admin class?? main method,
and use the methods from property class to perform( whatever)

thanx everyone..

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Cannot invoke addProperty(String, String, String, double) on the array type Property[]
Cannot invoke printPropertyDetails(String, String, String, double) on the array type Property[]

at Administration.main(Administration.java:57)

public class Administration     // admin class
	public static void main(String[] args)     // main method
   {  
	   Property properties[] = new  Property[10];   //array of object
	   int count = 0;	   
	   properties[count] = new Property("AP001", "2-bedroom apartment with city views", "Docklands", 550);  
	   count++;
	   properties[count] = new Property("UN112", "modern 3-bedroom unit", "Seddon", 465);
	   count++;
	   properties[count] = new Property("AP002", "older style 1-bedroom flat with gas cooking", "South Yarra", 310);


Menu();	     
	   num = getAnswer();			
	   while(num != 9)
	   {
		  if (num == 1)
			  properties .addProperty("ID", "description", "location", 0.0);        // this  method  doesn't work, i don't understand,  i can't access array
		  else if (num == 2)
			       System.out.println("this is 2");	
		  else if (num == 3)
			       System.out.println("this is 3");




class Property 

private String ID;            // instance variable
   private String description;
   private String location;

 public Property (String pID, String pDesc, String pLOc, double weeklyR )
   {   
	  ID = pID;
	  description = pDesc;
	  location = pLOc;
	  weeklyRR = weeklyR;	
	  status = 'A';
	  visibility = false;
   }                                         // constructor


public void addProperty(String pID, String pDesc, String pLOc,double weeklyR)
   {  
	  Scanner scan = new Scanner(System.in);
	  Property properties[] = new  Property[10];
	  int count = 6;	 	   
	  System.out.println("Enter ID");
	  String ID = scan.nextLine();
	  System.out.println("Enter Description");
	  String description = scan.nextLine();
	  System.out.println("Enter Location");
	  String location = scan.nextLine();
	  System.out.println("Enter weekly rental rate");
	  double weeklyRR = scan.nextDouble();	  
	  properties[count] = new Property("ID", "description", "location", 0.0);
	  count++;
   }                                               // method addProperty


 public void printPropertyDetails(String pID, String pDesc, String pLOc,double weeklyR)
   {
	   for (int count = 0; count <10 ; count++)
	        System.out.println("Property "+getID()+" "+getDescription()+" "+getLocation()
	        		           +" "+getWeeklyRR());  
   }                               //method  print property details
commented: Reminder to use CODE tags completely ignored. +0

post code using the CODE tags. what do you mean code tags??
is it //comments ?
thanx mate

The rightmost icon above the input window showing: [ code ] will put code tags around the selected code.

properties.addProperty("ID", "description", "location", 0.0);

The properties variable shown above is an array, not a class with a method called addProperty(). What class has the method: addProperty()?
Does the Property class have that method?
You need to use an index to get to an element in the properties array. The elements of the property array are of type Property.
properties[ix] // Get the Property object at the ix position in the array

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.