POJ 1004 Financial Management 原

圣洁之子

Financial Management
 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 164661 Accepted: 61136

Description

Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first step is to figure out what's been going on with his money. Larry has his bank account statements and wants to see how much money he has. Help Larry by writing a program to take his closing balance from each of the past twelve months and calculate his average account balance.

Input

The input will be twelve lines. Each line will contain the closing balance of his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included.

Output

The output will be a single number, the average (mean) of the closing balances for the twelve months. It will be rounded to the nearest penny, preceded immediately by a dollar sign, and followed by the end-of-line. There will be no other spaces or characters in the output.

Sample Input

``````100.00
489.12
12454.12
1234.10
823.05
109.20
5.27
1542.25
839.18
83.99
1295.01
1.75``````

Sample Output

``\$1581.42``

Source

``````import java.util.*;
import java.text.*;

public class Main {
public static void main(String[] args){
Scanner cin = new Scanner(System.in);

float value = 0;
float temp = 0;

for(int i=0; i<12; i++){
temp = Float.valueOf(cin.nextLine()).floatValue();
value += temp;
}
cin.close();
value = value / 12;

DecimalFormat df = new DecimalFormat(".00");
String str = df.format(value);

System.out.println("\$" + str);
}
}``````

``````//import java.io.BufferedInputStream;
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
//Scanner in = new Scanner(new BufferedInputStream(System.in));
Scanner in = new Scanner(System.in);
String str = null;
BigDecimal total = new BigDecimal(0);
for(int i=0; i<12; i++){
str = in.nextLine();
}
in.close();
BigDecimal average = total.divide(new BigDecimal(12));
System.out.println("\$" + average.toString());
}
}``````

圣洁之子

Apache Syncope 2.0.3 发布，数字身份管理

Apache Syncope 2.0.3 发布了，Apache Syncope 是用在企业环境的数字身份管理，在JEE技术的实施和Apache 2.0许可下发布的开源系统。 虽然这只是一个次要版本，但是带来了大量的修复，以及一些...

2017/04/19
466
1
GLPI 0.85-RC1 发布，信息资源管理器

GLPI 0.85-RC1 发布，此版本更新内容如下： complete management of components (inventory of components with financial stock management) ITIL change management (requester, impact an......

oschina
2014/06/19
757
0

2016/04/02
82
1

ACM的竞赛性强,因此自己应该和自己的实际应用联系起来.适合自己的才是好的,有的人不适合搞算法,喜欢系统架构,因此不要看到别人什么就眼红,发挥自己的长处,这才是重要的. 第一阶段：练经典常用...

long0404
2015/06/24
0
0

Job Description: Lead teams implementing business, process or technology changes for Financial Services - Capital Markets clients. Responsibilities will include developing techn......

bldwd
2011/08/02
557
0

stars永恒
11分钟前
0
0
nginx日志自动切割

1.日志配置（Nginx 日志） access.log----记录哪些用户,哪些页面以及用户浏览器,IP等访问信息；error.log------记录服务器错误的日志 #配置日志存储路径：location / {      a...

em_aaron

1
0
java 反射

1
0

https://www.cnblogs.com/ysocean/p/7409779.html#_label0

3
0

12月28日消息，小米科技创始人兼CEO雷军微博表示，小米移动任我行套餐方案，原则上就是明明白白消费，用多少付多少，不用不花钱！上网、电话和短信都是一毛钱，上网0.1元/M，电话0.1元/分钟，...

linuxCool

6
0