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");
}
}