Monday, April 27, 2009

GUI

School
? Catchment area of school defines the area of houses influenced by the presence of the school.
? Catchment area for schools is 3km.
? The degree to which a school is considered good or bad is its influence level.
? Influence level is randomly assigned to each school in neighbourhood.
? Influence level: -10 being the worst (negatively influenced), 10 being the best (positively influenced).
? Houses within the 3km proximity radius will show an increase in price of 15%
? However “bad” schools will have no negative effect on house price.

Industrial Estates
? Catchment area of industrial estates defines the area of houses influence by its presence.
? Catchment area for industrial estates is 0.5km
? Industrial estate agents will group together to from an “industrial estate.”
? Industrial estates will have an influence level of -6.

Topography
? Topography defined as scenic areas, countryside, lakes, parks.
? Catchment area of topography defines the area of houses influence by its presence.
? Catchment area for topography 0.5km.
? Influence level for topography range from +5 to +10


Pubs
? Catchment area for pubs ranges from 0.5km to 4km
? Houses within 0.5km of the pub will negatively influence house prices by 8%
? Houses within 0.5km of pubs will carry the negative influence level of
? Houses outside 0.5km of the pub will positively influence house prices by 3%
? Houses outside 0.5km of pubs will carry the positive influence level of
? Influence level for topography range from +5 to +10

Town Centre
? Catchment area for town centre is 1.5km
? Houses prices within this catchment area will be positively influenced by 20%


Interest rates
? When interest rates increase, demand for housing decreases, therefore decrease in price.
? Interest rate ranges from 0 to 15.
? Demand for housing will be measured as a percentage change of the interest rate.
? E.g. if interest rate increases from 4.0 to 4.6 (change being +0.6) then demand decreases by 15% as does house price.

Policing Level
? If level of policing is 0-30% reduce all agents influence level by 5.
? If level of policing is 30-60% reduce all agents influence level by 3.
? If level of policing is 60-100% reduce all agents influence level by 1.




Inputs
Before the simulation is run the user will be able to set up the neighbourhood.

Interest rates
? Interest rates will range from 0 to 15.
? User will have the option to set default value for simulation (5)

Population
? Users will also be able to set the population density for the neighbourhood.
? Population density will range from 0 to 100%
? And will directly effect demand e.g. when population is at 100%, demand is at its highest (therefore price will be equally as high).
? User will have the option to set default value for simulation (75%)
?
Level of policing

General Inputs
? Users will be able to set default values for everything to allow the system run a controlled simulation.
? Users can set the catchment area and influence level for each amenity
? All houses start off with a default price of £100,000


Outputs
The outputs will be shown on a GUI that will help analyse the simulation as a whole.
Each agent will have its own colour, for example houses will be in blue, topography in green and so on.
To represent the difference in house price within the actual simulation, differeing house prices will be represented by different shades of blue. For example houses prices between 0 and 50,000 will show as a light blue, 50,000 to 100,000 a darker shade, 100,000 to 150,000 an even darker shade, until it reaches its maximum category 300,000+.


? Display all input values including interest rate, population
? The number of houses in the simulation
? The number of houses in each price category
? The average house price will be calculated
? The highest and lowest house price will be displayed
? Display the number of each amenity-school pubs topography etc



import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Rectangle2D.Double;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.Graphics;
import java.awt.Color;
public class HouseMarketGUI extends JFrame implements ActionListener{

int population ;
int interestRate ;
int policingLevel ;



static HouseMarketGUI gui;
//Page1 GUI Variables
private JLabel p1labelt;
private JLabel p1labeltSub;
private JFrame p1frame;
private JLabel p1popLable;
private JLabel p1intLable;
private JLabel p1poliLable;
private JTextField p1popValue;
private JTextField p1intValue;
private JTextField p1poliValue;

private JButton p1button;
//end


public HouseMarketGUI(){



// size = new Dimension(0, 0);
// stats = new FieldStats();
// JPanel cp = new JPanel(new GridLayout(1, 1));
// JPanel cp1 = new JPanel();
//Page1 Create Object
p1frame= new JFrame(" Housing Market Simulation ");
p1frame.getContentPane().setLayout(null);

p1labelt = new JLabel("Housing Market Simulation");
p1labelt.setFont(new Font("Serif", Font.BOLD, 20));
p1labelt.setBounds(150,0,350,70);

p1labeltSub = new JLabel("Setup Environment");
p1labeltSub.setFont(new Font("Serif", Font.BOLD, 18));
p1labeltSub.setBounds(50,40,350,70);

p1popLable = new JLabel("Population(0-100)%");
p1popValue = new JTextField(35);
p1popValue.setText("75");
p1intLable = new JLabel("Interest Rate(0-15)");
p1intValue = new JTextField(35);
p1intValue.setText("5");

p1poliLable = new JLabel("Policing Level(0-100)%");
p1poliValue = new JTextField(35);
p1poliValue.setText("50");

p1button = new JButton("NEXT");
//end


//Page1 Position
p1popLable.setBounds(50,100,150,70);
p1intLable.setBounds(50,150,150,70);

p1popValue.setBounds(220,120,50,30);
p1intValue.setBounds(220,170,50,30);

p1poliLable.setBounds(50,200,150,70);
p1poliValue.setBounds(220,220,50,30);

p1button.setBounds(370,330,80,27);
//end

//page1 add contentPanel
p1frame.getContentPane().add(p1labelt);
p1frame.getContentPane().add(p1labeltSub);

p1frame.getContentPane().add(p1popLable);
p1frame.getContentPane().add(p1popValue);
p1frame.getContentPane().add(p1intLable);
p1frame.getContentPane().add(p1intValue);

p1frame.getContentPane().add(p1poliLable);
p1frame.getContentPane().add(p1poliValue);

p1frame.getContentPane().add(p1button);
//end



//page1 actionListener
p1button.addActionListener(this);
p1frame.setSize(550,550);
p1frame.setVisible(true);
//end




}

public void actionPerformed(ActionEvent event){

if(event.getSource() == p1button){
p1frame.setVisible(false);
p2frame.setVisible(true);
p3frame.setVisible(false);

p2namevalue.setText("0.5");
p2numberValue.setText("0.5");
p2salaryValue.setText("1.5");
p2pubValue.setText("0.5");
p2schoolValue.setText("3.0");

p2namevalue.setEditable(false);
p2numberValue.setEditable(false);
p2salaryValue.setEditable(false);
p2pubValue.setEditable(false);
p2schoolValue.setEditable(false);

population = Integer.parseInt(p1popValue.getText());
interestRate = Integer.parseInt(p1intValue.getText());
policingLevel = Integer.parseInt(p1poliValue.getText());






}



}



public static void main(String arg[]){


gui = new HouseMarketGUI();

}

}

No comments:

Post a Comment