retire or not retire ? is a question.
corejava 上的一段代码 因吹思婷
"C:\Program Files\Java\jdk1.8.0_101\bin\java" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_101\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\rt.jar;D:\MyTest\out\production\MyTest;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain MyTest
How much money will you contribute every year
2700
Internet rate in %:
0.1
After year 1,your balance is 2,702.70
Ready to retire?(Y/N)N
After year 2,your balance is 5,408.10
Ready to retire?(Y/N)N
After year 3,your balance is 8,116.21
Ready to retire?(Y/N)N
After year 4,your balance is 10,827.03
Ready to retire?(Y/N)N
After year 5,your balance is 13,540.55
Ready to retire?(Y/N)N
After year 6,your balance is 16,256.79
Ready to retire?(Y/N)N
After year 7,your balance is 18,975.75
Ready to retire?(Y/N)N
After year 8,your balance is 21,697.43
Ready to retire?(Y/N)
import java.util.*;
public class MyTest{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.print("How much money will you contribute every year");
double payment = in.nextDouble();
System.out.print("Internet rate in %: ");
double interestRate = in.nextDouble();
double balance = 0;
int year = 0;
String input;
//update account balance while user isn't ready to retire
do{
//add this year's payment and interest
balance += payment;
double interest = balance * interestRate / 100;
balance += interest;
year++;
//print current balance
System.out.printf("After year %d,your balance is %,.2f%n", year, balance);
//ask if ready to retire and get input
System.out.print("Ready to retire?(Y/N)");
input = in.next();
}while(input.equals("N"));
}
}
retire or not retire ? is a question.的更多相关文章
- .保护Express应用程序
毫无疑问,Node.js已经变的愈加成熟,尽管这样,开发者仍然缺乏大量的安全指南.在这篇文章中,我将分享一些有关Node.js安全要点给大家,希望大家能够谨记于心. 1.避免使用Eval Eval并不 ...
- Understanding G1 GC Logs--转载
原文地址:https://blogs.oracle.com/poonam/entry/understanding_g1_gc_logs Understanding G1 GC Logs By Poon ...
- EOS基础全家桶(十四)智能合约进阶
简介 通过上一期的学习,大家应该能写一些简单的功能了,但是在实际生产中的功能需求往往要复杂很多,今天我就继续和大家分享下智能合约中的一些高级用法和功能. 使用docker编译 如果你需要使用不同版本的 ...
- 全网最硬核 JVM TLAB 分析(单篇版不包含额外加菜)
今天,又是干货满满的一天.这是全网最硬核 JVM 系列的开篇,首先从 TLAB 开始.由于文章很长,每个人阅读习惯不同,所以特此拆成单篇版和多篇版 全网最硬核 JVM TLAB 分析(单篇版不包含额外 ...
- retire
retire 本来抱着进队的决心迎战,结果在第一试就失利,是能力不足,还是命中注定我不是竞赛的料,一切关于OI的事随着GDOI2016的闭幕而消散-- 今后也许再也不搞OI了,或许会玩一下ACM,现在 ...
- Timberwolves forward Kevin Garnett to retire _洛杉矶时报
Timerwolves:森林狼队,forward:前锋; kevin Garnett,the best player in Minnesota Timberwolves history,is expe ...
- an interview question(1)
声明:本文为博主原创文章,未经博主允许不得转载. 以下是英文翻译: warnning: Copyright!you can't reprint this blog when you not get b ...
- nullcon HackIM 2016 -- Crypto Question 1
You are in this GAME. A critical mission, and you are surrounded by the beauties, ready to shed thei ...
- Stack Overflow is a question and answer site
http://stackoverflow.com/ _ Stack Overflow is a question and answer site for professional and enthus ...
随机推荐
- HDU 3966:Aragorn's Story(树链剖分)
http://acm.hdu.edu.cn/showproblem.php?pid=3966 题意:有n个点n-1条边,每个点有一个权值,有两种操作:询问一个点上权值是多少和修改u到v这条链上的权值. ...
- bootstrap/moban191/js/templatemo_custom.js
(function($) { "use strict"; // Cache selectors var lastId, topMenu = $(".menu-holder ...
- yjfk 意见反馈
<div> <h1>我的第一个 JavaScript 程序</h1><p id="demo">这是一个段落</p>< ...
- 使用radioGroup的时候,每个radioButton的状态选择器要使用 state_checked=""属性,不能使用selected
使用radioGroup的时候,每个radioButton的状态选择器要使用 state_checked=""属性,不能使用selected
- 如何调动员工的积极性 -引用LTP.Net知识库
也许是老板的意识不强,也许员工的意识薄弱,关于老板的意识强不强,我们只能看他是只顾眼前的利益,还是放眼于未来呢. 1:有一个领导的样子现在,在我国,聊天是非常时髦的,也非常受我们这个年龄段的人欢迎.如 ...
- JQuery-Table斑马线
HTML <html> <head> <link href="StyleSheet.css" rel="stylesheet" t ...
- 大型网站技术架构介绍--squid
一.大型网站技术架构介绍 1.pv高 ip高 并发量 2.大型网站架构重点 1. 高性能:响应时间,TPS,系统性能计数器.缓存,消息队列等. 高可用性High Availabilit ...
- Android中XML解析
package com.example.thebroadproject; public class Book { private int id; private String name; privat ...
- Easyui Layout Center 全屏方法扩展
$.extend($.fn.layout.methods, { full : function (jq) { return jq.each(function () { var layout = $(t ...
- java安全令牌生成器
SecureRandom sr = new SecureRandom(); byte[] bytes = new byte[8]; bytes = sr.generateSeed(8); System ...