玻璃浴室-双汇发展股票

房贷计算器代码2.0
2023年9月17日发(作者:贡菲)

房贷计算器代码2.0

1 using System;

2 using c;

3 using ;

4 using ;

5 using ;

6 using g;

7 using tion;

8 using kInformation;

9

10 namespace play

11 {

12 class Program

13 {

14 //短期利率与长期利率

15 double lowRate = 0;

16 double highRate = 0;

17

18 //KeyValuePair;

19 DateTime dt1 = new DateTime(2015, 3, 1);

20 DateTime dt2 = new DateTime(2015, 5, 11);

21 DateTime dt3 = new DateTime(2015, 6, 28);

22 DateTime dt4 = new DateTime(2015, 8, 26);

23 //贷款⾦额

24 static double totalMoney, balance;

25

26 static string choice;

27 static string newChoice;

28 //期数

29 int n;

30 //⽉供

31 double payMonth;

32 double rate;

33 double interest;

34 ///

35 /// ⽤来构建欢迎界⾯

36 ///

37 void Paint()

38 {

39 ine("***************************");

40 ine("***************************");

41 ine("***************************");

42 ine("欢迎使⽤房贷计算器");

43 ine("***************************");

44 ine("***************************");

45 ine("***************************");

46

47 ine("请按任意键继续");

48 y();

49 ();

50 }

51 ///

52 /// 按⽇期选择利率

53 ///

54 /// 输⼊的⽇期

55 void RateChoose(DateTime dt)

56 {

57 if (dt >= dt4)

81 (0);

82 }

83 }

84 ///

85 /// 计算⽉供

86 ///

87 void Payment(DateTime dt)

88 {

89 //设置缓冲区⾼度,即设置显⽰的最⼤⾏数

90 Height = 1000;

91 RateChoose(dt);

92 switch (choice)

93 {

94 case "1":

95 {

96 //等额本息,⽉供计算⽅法

97 for (n = 1; n <= 360; n++)

98 {

99

100

101 if (n <= 60)

102 {

103 rate = lowRate;

104 }

105 else

106 {

107 rate = highRate;

108 }

109 //计算⽉供

110 double p;

111 p = rate / 12;

112 payMonth = (p * totalMoney * ((1 + p), n)) / (((1 + p, n) - 1));

113 //利息

114 interest = n * payMonth;

115 if (n % 2 == 0)

116 {

117 oundColor = ;

118 }

119 else

120 {

121 oundColor = ;

122 }

123 ine("{0}期按揭贷款的⽉供是{1:0.00}元,总利息是{2:0.00}", n, payMonth, interest);

124

125 }

126 }

127 break;

128 case "2":

129 {

130 //等额本⾦,⽉供计算⽅法

131 for (n = 1; n <= 360; n++)

132 {

133 if (n <= 60)

134 {

135 rate = lowRate;

136 }

137 else

138 {

139 rate = highRate;

140 }

141 //计算⽉供

142 double p;

143 p = rate / 12;

144 payMonth = (totalMoney / n) + totalMoney * p;

145 interest = ((totalMoney / n + totalMoney * p) + totalMoney / n * (1 + p)) / 2 * n - totalMoney;

146 ine("{0}期按揭贷款的⾸⽉还款额是{1:0.00},总利息是{2:0.00}", n, payMonth, interest);

147 }

148 }

149 break;

150 }

151 }

152

153 ///

154 /// ⽉贷计算⽅法

155 ///

156 /// 还款期数

157 void Compute(int n)

158 {

159 ine("期次tt偿还利息tt偿还本⾦tt还款额tt剩余本⾦");

160 switch (choice)

161 {

162

163 case "1":

164 //等额本息法计算房贷

165 {

166 if (n <= 60)

167 {

168 rate = lowRate;

169 }

170 else

171 {

172 rate = highRate;

173 }

174

175 double p;

176 p = rate / 12;

177 payMonth = (p * totalMoney * ((1 + p), n)) / (((1 + p, n) - 1));

178 for (int i = 1; i <= n; i++)

179 {

180 //string s = ng();

181 interest = totalMoney * p;

182 double capital = payMonth - interest;

183 totalMoney -= capital;

184 ine("{0}tt{1:0.00}tt{2:0.00}t{3:0.00}t{4:0.00}", i, interest, capital, payMonth, totalMoney);

185 }

186 }

187 break;

188 case "2":

189 //等额本⾦法计算房贷

190 {

191 if (n <= 60)

192 {

193 rate = lowRate;

194 }

195 else

196 {

197 rate = highRate;

198 }

199 double p;

200 p = rate / 12;

201 double capital = totalMoney / n;

202 for (int i = 1; i <= n; i++)

203 {

204

205 interest = totalMoney * p;

206 payMonth = capital + interest;

207 totalMoney -= capital;

208

209 ine("{0}tt{1:0.00}ttt{2:0.00}tt{3:0.00}t{4:0.00}", i, interest, capital, payMonth, totalMoney);

210 }

211 }

212 break;

213

214 }

215 }

216 ///

217 /// 计算还款状况

218 ///

219 /// 还款期数

220 /// ⾸次还款时间

249 if ( != && rate != rate0)//这⾥应该有问题?

250 {

251 double p0 = rate0 / 12;

252 double payMonth0= (p0 * totalMoney * ((1 + p0), n)) / (((1 + p0, n) - 1));

253 double interest0 = balance * p0;

254 double capital0 = payMonth0 - interest0;

255

256 rate0 = rate;

257

258 interest = balance * (rate0/12);

259 totalMoney = balance;

260 balance -= capital0;

261

262 payMonth = capital0 + interest;

263 n =n0 - i+1;

264 ine("{0}t{1:0.00}ttt{2:0.00}ttt{3:0.00}tt{4:0.00}", dt, interest, capital0, payMonth, balance);

265 dt = ths(1);

266 continue;

267 }

268

269

270

271 p = rate0 / 12;

272 payMonth = (p * totalMoney * ((1 + p), n)) / (((1 + p, n) - 1));

273

274 interest = balance * p;

275 capital = payMonth - interest;

276 balance -= capital;

277 ine("{0}t{1:0.00}ttt{2:0.00}ttt{3:0.00}tt{4:0.00}", dt, interest, capital, payMonth, balance);

278 dt = ths(1);

279

280 }

281

282 }

283 break;

284 case "2":

285 {

286 RateChoose(dt0);

287 rate0 = (n0 <= 60 ? lowRate : highRate);

288 n = n0;

289 for (int i = 0; i < n0; i++)

290 {

291 RateChoose(dt);

292 rate = (n0 <= 60 ? lowRate : highRate);

293 if (!=&&rate!=rate0)

294 {

295 rate0 = rate;

296 }

297 p = rate0 / 12;

298 capital = totalMoney / n0;

299 interest = balance * p;

300 payMonth = capital + interest;

301 balance -= capital;

302 ine("{0}t{1:0.00}ttt{2:0.00}ttt{3:0.00}tt{4:0.00}", dt, interest, capital, payMonth, balance);

303 dt = ths(1);

304 }

305 }

306 break;

307 }

308 }

309 ///

310 ///实现提前还款功能

311 ///

312 /// 还款总期数

313 /// ⾸次还款时间

314 /// 提前还款时间

315 void Prepayment(int n0,DateTime dt1,DateTime dt2,double money)

316 {

317 balance = totalMoney;

318 DateTime dt0 = dt1;

319 double rate0;

320 double capital;

321 double p;

322 bool flag = false;

323 ine("还款时间tt偿还利息tt偿还本⾦tt还款额tt剩余本⾦");

324 switch (choice)

325 {

326 case "1":

327 {

328 RateChoose(dt0);

329 rate0 = (n0 <= 60 ? lowRate : highRate);

333 RateChoose(dt1);

334 rate = (n0 <= 60 ? lowRate : highRate);

335

336

337 if ( != && rate != rate0)//这⾥应该有问题?

338 {

339 double p0 = rate0 / 12;

340 double payMonth0 = (p0 * totalMoney * ((1 + p0), n)) / (((1 + p0, n) - 1));

341 double interest0 = balance * p0;

342 double capital0 = payMonth0 - interest0;

343

344 rate0 = rate;

345

346 interest = balance * (rate0 / 12);

347 totalMoney = balance;

348 balance -= capital0;

349

350 payMonth = capital0 + interest;

351 n = n0 - i + 1;

352 ine("{0}t{1:0.00}ttt{2:0.00}ttt{3:0.00}tt{4:0.00}", dt1, interest, capital0, payMonth, balance);

353 dt1 = ths(1);

354 continue;

355 }

356

357

358

359 p = rate0 / 12;

360 if ( == && == )

361 {

362 balance -= money;

363 totalMoney = balance;

364 switch (newChoice)

365 {

366 case "1":

367 {

368

369 n = n0 - i + 1;

370 flag = true;

371 }

372 break;

373 case "2":

374 {

375 double temp = ((payMonth / (payMonth - totalMoney * p)), (1 + p));

376 n= (int)g(temp);

377 n0 = n + i - 1;

378 }

379 break;

380 }

381

382 }

383 payMonth = (p * totalMoney * ((1 + p), n)) / (((1 + p, n) - 1));

384

385

386 interest = balance * p;

387 capital = payMonth - interest;

388 balance -= capital;

389 if (flag)

390 {

391 payMonth += money;

392 capital += money;

393 flag = false;

394 }

395 ine("{0}t{1:0.00}ttt{2:0.00}ttt{3:0.00}tt{4:0.00}", dt1, interest, capital, payMonth, balance);

396 dt1 = ths(1);

397 }

398 }

399 break;

400 case "2":

401 {

402

403 }

404 break;

405 }

406 }

407 static void Main(string[] args)

408 {

409

410 {

411 Program p = new Program();

412 ();

417 totalMoney = le(ne());

418 ine("请输⼊您贷款的期数");

419 int number = 32(ne());

420 ine("请输⼊你的⾸次贷款时间");

421 DateTime dT = Time(ne());

422 ine("请输⼊你的提前还款时间");

423 DateTime dTR = Time(ne());

424 ine("请输⼊你的还款⾦额");

425 double partMoney = le(ne());

426 ine("请选择你要的后续操作!1.减少⽉供 2.缩短年限");

427 newChoice = ne();

428 //ine("你输⼊的⽇期是{0},短期利率是{1},长期利率是{2}",dT,e,te);

429 //dT= ths(1);

430 // ine(dT);

431 // ent(number, dT);

432 // e(number);

433 // t(dTR);

434 ment(number, dT, dTR, partMoney);

435 y();

436 }

437 }

438 }

439 }

led优点-威立雅水务

房贷计算器代码2.0

更多推荐

房贷计算器最新2012