賃貸or分譲 Simulation
http://allabout.co.jp/r_house/gc/29993/
http://マンション掲示板.ファイブディグリーズ.jp/bbs/thread/60025/40
http://www.minimalcomps.com/documentation/com/bit101/components/Component.html
http://www40.atwiki.jp/spellbound/pages/97.html
↑参考
/**
* Copyright YAZUMA ( http://wonderfl.net/user/YAZUMA )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mlB6
*/
//http://allabout.co.jp/r_house/gc/29993/
//http://マンション掲示板.ファイブディグリーズ.jp/bbs/thread/60025/40
//http://www.minimalcomps.com/documentation/com/bit101/components/Component.html
//http://www40.atwiki.jp/spellbound/pages/97.html
//↑参考
package {
import flash.ui.Mouse;
import flash.display.*;
import flash.text.*;
import flash.events.*;
import fl.controls.*;
import flash.utils.Timer;
import mx.collections.ArrayCollection;
import com.bit101.components.Window;
import com.bit101.components.InputText;
import com.bit101.components.PushButton;
import com.bit101.components.Meter;
import com.bit101.components.HSlider;
import com.bit101.components.VSlider;
import com.bit101.components.HUISlider;
import com.bit101.components.VUISlider;
import com.bit101.components.Text;
import com.bit101.components.RadioButton;
import com.bit101.components.Panel;
import com.bit101.components.NumericStepper;
import com.bit101.components.List;
import com.bit101.components.Style;
[SWF(backgroundColor=0xf0f0f0,frameRate=60)]
public class sp extends Sprite {
public var window:Array = [];
public var list:List;
public var list2:List;
private var data_shinagawa:Array = [];
private var data_yokohama:Array = [];
private var data_kawasaki:Array = [];
private var data_musashi:Array = [];
private var data:Array = [];
private var panel:Panel;
private var panel2:Panel;
private var INDEX:int = 0;
private var tf:TextField = new TextField();
private var tf2:TextField = new TextField();
private var tf3:TextField = new TextField();
private var s1:Sprite = new Sprite();
public function sp():void{
Style.embedFonts = false;
Style.fontSize = 10;
addChild(s1);
initition();
}
private function initition():void{
list = new List(this, 20, 10);
list.addEventListener(Event.SELECT, onSelect);
list.addItem("品川駅 (1)");
list.addItem("川崎駅 (2)");
list.addItem("横浜駅 (2)");
list.addItem("武蔵小杉駅 (1)");
list2 = new List(this, 140, 10);
list2.width = 300;
list2.addEventListener(Event.SELECT, onSelect2);
data_kawasaki.push(new DATA("ドールマウスキャッスル 1308 ", 7, "神奈川県川崎市川崎区本町2丁目7-7", 0, 0, 1, 130000, 10000, false, 75, 50));
data_shinagawa.push(new DATA("築浅タワーレジデンス", 5, "東京都港区港南1丁目", 0, 135000, 0, 135000, 0, false, 73, 47));
data_yokohama.push(new DATA("横浜のとある新築賃貸マンション", 9, "神奈川県横浜市西区平沼1丁目", 0, 0, 0, 74000, 8000, false, 90, 26));
data_kawasaki.push(new DATA2("サンクタス川崎タワー", 6, "神奈川県川崎市幸区中幸町3丁目16-4他", 0, 29300000, 4, true, 75, 50));
data_yokohama.push(new DATA2("グローベル ザ・スイート 横浜", 9, "神奈川県横浜市西区平沼1丁目74番7他", 0, 21900000, 4, true, 90, 27));
data_musashi.push(new DATA2("ナイスシティアリーナ武蔵小杉ブライトコート", 6, "神奈川県川崎市中原区中丸子字中町182番2他", 0, 30000000, 4, true, 75, 30));
panel = new Panel(this, 20, 120);
panel.width = 420;
panel.height = 190;
tf.width = 300;
tf.x = 10;
tf.y = 10;
tf2.width = 300;
tf2.x = 10;
tf2.y = 85;
panel.content.addChild(tf);
panel.content.addChild(tf2);
panel2 = new Panel(this, 20, 320);
panel2.width = 420;
tf3.text = "Best 物件\nケース : \n物件名 : \n最寄駅への時間 : 分\n築 : 年\n10年間の必要経費 :";
tf3.width = 300;
panel2.content.addChild(tf3);
tf.text = tf.text = "ケース : \n物件名 : \n住所 : \n最寄駅への時間 : 分\n築 : 年";
best();
}
private function best():void{
var d:Array = [];
var best_price:Number = Number.POSITIVE_INFINITY;
var price:Number;
if(data_shinagawa.length != 0)for(var i:int = 0;i < data_shinagawa.length;i++){
if(data_shinagawa[i].mantion == true)price = Bunjou(data_shinagawa[i].value);
else price = Tintai(data_shinagawa[i].siki, data_shinagawa[i].rei, data_shinagawa[i].tintai, data_shinagawa[i].kanri);
if(price < best_price){
best_price = price;
d[0] = data_shinagawa[i];
}
}
if(data_kawasaki.length != 0)for(i = 0;i < data_kawasaki.length;i++){
if(data_kawasaki[i].mantion == true)price = Bunjou(data_kawasaki[i].value);
else price = Tintai(data_kawasaki[i].siki, data_kawasaki[i].rei, data_kawasaki[i].tintai, data_kawasaki[i].kanri);
if(price < best_price){
best_price = price;
d[0] = data_kawasaki[i];
}
}
if(data_yokohama.length != 0)for(i = 0;i < data_yokohama.length;i++){
if(data_yokohama[i].mantion == true)price = Bunjou(data_yokohama[i].value);
else price = Tintai(data_yokohama[i].siki, data_yokohama[i].rei, data_yokohama[i].tintai, data_yokohama[i].kanri);
if(price < best_price){
best_price = price;
d[0] = data_yokohama[i];
}
}
if(data_musashi.length != 0)for(i = 0;i < data_musashi.length;i++){
if(data_musashi[i].mantion == true)price = Bunjou(data_musashi[i].value);
else price = Tintai(data_musashi[i].siki, data_musashi[i].rei, data_musashi[i].tintai, data_musashi[i].kanri);
if(price < best_price){
best_price = price;
d[0] = data_musashi[i];
}
}
if(d[0].mantion == true)var C:String = "分譲中";
else C = "賃貸";
tf3.text = tf.text = "Best 物件\nケース : "+C+"\n物件名 : "+d[0].name+"\n最寄駅への時間 : "+d[0].walk+"分\n築 : "+d[0].old+"年\n10年間の必要経費 :"+Math.floor(best_price / 10000)+"万円";
}
private function onSelect(event:Event):void{
var li:List = event.currentTarget as List;
list2.removeAll();
if(li.selectedIndex == 0)data = data_shinagawa;
if(li.selectedIndex == 1)data = data_kawasaki;
if(li.selectedIndex == 2)data = data_yokohama;
if(li.selectedIndex == 3)data = data_musashi;
INDEX = li.selectedIndex;
if(data.length != 0){
for(var i:int = 0;i < data.length; i++)list2.addItem(data[i].name);
}
}
private function onSelect2(event:Event):void{
var li:List = event.currentTarget as List;
var CASE:String;
var price:Number;
if(data[li.selectedIndex].mantion == false){
CASE = "賃貸";
price = Tintai(data[li.selectedIndex].siki, data[li.selectedIndex].rei, data[li.selectedIndex].tintai, data[li.selectedIndex].kanri);
tf2.text = "敷金 : "+data[li.selectedIndex].siki+"円\n礼金 : 賃料"+data[li.selectedIndex].rei+"ヶ月分\n賃料 : "+data[li.selectedIndex].tintai+"円\n管理費 : "+data[li.selectedIndex].kanri+"円\n\n10年間の必要経費 : "+Math.floor(price/10000)+"万円";
}
else{
CASE = "分譲中";
//10年間のローンを含めた借入金額
price = Bunjou(data[li.selectedIndex].value);
tf2.text = "物件価格 : "+data[li.selectedIndex].value/10000+"万円\n10年間の必要経費 : "+Math.floor(price / 10000)+"万円";
}
tf.text = tf.text = "ケース : "+CASE+"\n物件名 : "+data[li.selectedIndex].name+"\n住所 : "+data[li.selectedIndex].location+"\n最寄駅への時間 : "+data[li.selectedIndex].walk+"分(通勤時間 男性:"+data[li.selectedIndex].male+"分 女性:"+data[li.selectedIndex].female+"分)\n築 : "+data[li.selectedIndex].old+"年";
}
private function Tintai(_siki:int, _rei:int, _tintai:int, _kanri:int):Number{
var price:Number = 5000000 - _siki - _rei * _tintai;
for(var i:int = 0; i < 10;i++){
price -= _tintai * 12;
price -= _kanri * 12;
if(price > 0)price *= 1.01;
}
price += _siki;
price = 5000000 - price;
return price;
}
private function Bunjou(value:int):Number{
var price:Number;
price = value - 5000000;
price = price * 0.04 / (1 - Math.pow(1 + 0.04, -10));
price *= 10;
price -= value *0.8;
price += 20000*12*10;
return price;
}
}
}
import flash.display.Sprite;
import flash.text.TextField;
import com.bit101.components.Window;
class WINDOW extends Window{
public function WINDOW():void{
var window:Window = new Window(null, 2,2);
}
}
import flash.text.*;
class PANEL extends TextField{
public var build_name:String;
public var walk:int;
public var location:String;
public var old:int;
public var mantion:Boolean;
public var tintai:int;
public var kanri:int;
public var value:int;
public var parce_year:Number;
public var tf:TextField;
public var s1:Sprite = new Sprite();
public function PANEL():void{
tf = new TextField();
tf.text = "ケース : "+"\n"+"物件名 : "+build_name+"\n住所 : "+location+
"最寄駅への時間 : "+walk+" 分\n築 : "+old+"年\n";
s1.addChild(tf);
}
}
class DATA{
public var name:String;
public var walk:int;
public var location:String;
public var old:int;
public var mantion:Boolean;
public var siki:int;
public var rei:int;
public var tintai:int;
public var kanri:int;
public var male:int;
public var female:int;
public function DATA(_name:String, _walk:int, _location:String, _old:int, _siki:int, _rei:int, _tintai:int
, _kanri:int, _mantion:Boolean, _male:int, _female:int):void{
name = _name;
walk = _walk;
location = _location;
old = _old;
mantion = _mantion;
siki = _siki;
rei = _rei;
tintai = _tintai;
kanri = _kanri;
male = _male;
female = _female;
}
}
class DATA2{
public var name:String;
public var walk:int;
public var location:String;
public var old:int;
public var mantion:Boolean;
public var value:int;
public var parce_year:Number;
public var male:int;
public var female:int;
public function DATA2(_name:String, _walk:int, _location:String, _old:int
, _value:int, _parce_year:Number, _mantion:Boolean, _male:int, _female:int):void{
name = _name;
walk = _walk;
location = _location;
old = _old;
mantion = _mantion;
value = _value;
parce_year = _parce_year;
male = _male;
female = _female;
}
}