|
等 级:资深长老 |
经 验 值:3411 |
魅 力 值:276 |
龙 币:6985 |
积 分:3597.9 |
注册日期:2001-12-21 |
|
|
|
计算器………………………………………………(修)
import java.lang.*;
import java.util.*;
public class Calculator{
public static final int GOV_PRICE=4000;
int applyingArea; //你申请下来的面积
int price; //二期的房价
int wantingArea; //你想买的房子的面积
public static void main(String[] args){
try{
int aArea = Integer.parseInt(args[0]);
int price = Integer.parseInt(args[1]);
int wArea = Integer.parseInt(args[2]);
int result=totalPrice(aArea, price, wArea);
System.out.println("Total money you need to prepare is: " + result);
}catch(Exception e){
System.out.println("使用格式:\n" + "java Calculator applyArea thPrice wantBuyArea \n");
}
}
public static int totalPrice(int aArea, int price, int wArea){
int totalMoney = 0;
totalMoney = (price*wArea<=aArea*GOV_PRICE)?price*wArea : (aArea*GOV_PRICE+(price*wArea-aArea*GOV_PRICE)*10%);
return totalMoney;
}<br><font color=red>(此文在2002-04-12 09:41:50编辑过)</font><br><font color=red>(此文在2002-04-12 09:48:59编辑过)</font> (此文在2002-04-12 09:52:39编辑过)
|
|
|
|