I am trying to do several things.
1. Intialize - engage a user in a series of questions to assign values to the class variables, no args, no return value, called from constructor.
2. Display - displays all the class values, each in an sentence, no args, no return value.
3. getId - returns the id of the Property to the caller, no args, 1 return value, the id of this property. (needed in the "find" method of the class RealEstate.
4. calcTaxrate - calculates a tax rate, based on the values of the variables. It is not necessary to put any code into the body of this method.
Having a lot of trouble with this and appreciate any help.
import java.util.*;
public class RealEstate
{
private static Property[]database = new Property[64];
private static int propertyCount = 0;
class Property
{
private int id; //assigned by the program. It starts with 1.
private String address; //A single string, any contents
private int numberStories; // no half-stories
private int age; //in years
private int purpose; //residential, commercial
private boolean multiple; //true = multiple family, false = single family
private boolean externalWater; // true = outside water faucet exists
private int porchSize; // square feet. 0 = no porch
private int yardSize; //square feet. 0 = no yard.
}
public static void main(String[]args)
{
Scanner in = new Scanner(System.in);
Property address;
System.out.println("BigMarket Real Estate Inc.");
System.out.println("");
boolean finished = false;
while(finished ==false)
{
System.out.println("What would you like to do?");
System.out.println("Please type N for 'Enter New Property'");
System.out.println("D for 'Display Existing Propery'");
System.out.println("Q for 'Quit the Program;");
String answer = in.next();
if (answer.equals("Q") || answer.equals("q"))
{
System.out.println("Program terminating. Thank You!");
finished=true;
}
if(answer.equals("D")||answer.equals("d"));
{
System.out.println("Which property will you display?");
int where = in.nextInt();
address = find(where);
if(address !=null)
{
address.display();
}
else
{
System.out.println("Sorry.Sorry! Can't find that one.");
}
}
if(answer.equals("N")||answer.equals("n"));
{
database[propertyCount] = new Property(propertyCount+1);
propertyCount+=1;
}
}
}
private static Property find(int Id)
{
Property home = null;
for (int index = 0; index < propertyCount; index +=1)
{
if(database[index].getId() == Id)
{
home = database[index];
return home;
}
}
return home;
}
}