佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1704|回复: 16

Java问题,帮帮忙。

[复制链接]
发表于 18-9-2008 10:49 PM | 显示全部楼层 |阅读模式
Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest rate starting from 5% to 8%, with an increment of 1/8. Suppose you enter the loan amount 10,000 for five year; display a table as follows:

Loan Amount: 10000
Number of Years: 5

Interest Rate        Monthly Payment        Total Payment
5%                188.71                11322.74
5.125%                189.28                11357.13
5.25%                189.85                11391.59

7.85%                202.16                12129.97
8.0%                202.76                12165.83
回复

使用道具 举报


ADVERTISEMENT

发表于 18-9-2008 11:15 PM | 显示全部楼层
瓦老~~功课不自己做 将来肯定保你后悔
回复

使用道具 举报

发表于 18-9-2008 11:55 PM | 显示全部楼层
这样的问题是非常普通的练习题吧了..
如果连这也有问题..
我想你的JAVA课要白修了..
回复

使用道具 举报

发表于 19-9-2008 12:04 AM | 显示全部楼层
我对java也有少少知识,看你的问题大概也不会很难。你的老师大概也有叫你那些basic的coding吧? 不然去goggle search就因该有答案了。如果还是有问题你可以add我的msn:owen_hebe@hotmail.com 本人最讨厌见死不救的人。不帮就算了,还要在那边讲多多废话。。。:@:@:@
回复

使用道具 举报

发表于 19-9-2008 12:14 AM | 显示全部楼层
原帖由 Darren10 于 19-9-2008 12:04 AM 发表
我对java也有少少知识,看你的问题大概也不会很难。你的老师大概也有叫你那些basic的coding吧? 不然去goggle search就因该有答案了。如果还是有问题你可以add我的msn:wen_hebe@hotmail.com">owen_hebe@hotmail.com 本人最讨厌见死不救的人 ...


超人? 怎样救? 是不是帮他做埋, 写埋给他?
回复

使用道具 举报

 楼主| 发表于 19-9-2008 12:31 AM | 显示全部楼层
是做不出来呀!前面做了一点,但后面那边的那些我不会写。
回复

使用道具 举报

Follow Us
发表于 19-9-2008 09:29 PM | 显示全部楼层

回复 4# Darren10 的帖子

hi...
溺愛式教育是不對的
樓主應該問問題
或者自己先嘗試
然後貼出自己的code
給大家看看有什麼不對的地方
這樣才是正確的學習態度
回复

使用道具 举报

发表于 19-9-2008 09:39 PM | 显示全部楼层
讲真的,你的题目很乱水。我完全想不到那些数目是怎样算出来的。你解释一下?
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 20-9-2008 09:00 PM | 显示全部楼层

回复 7# cheng1986 的帖子

谢谢你!这是我做的,但答案有点怪。
int year = 5;
double interest_rate = 5;
double loan_amount = 10000;
double monthly_payment = 0;
double total_payment = 0;
char percent = '%';
      
Scanner scan = new Scanner(System.in);
      
System.out.println("Loan amount: " + loan_amount);
System.out.println("Number of Years: " + year);
System.out.println("Interest Rate \t Monthly Payment(RM) \t Total Payment(RM)");
      
do{
     interest_rate = (interest_rate * 1/8)+ interest_rate;
     total_payment = year * (interest_rate * loan_amount);
     monthly_payment = total_payment / (year * 12);
     
System.out.printf("%.3f %-10c %-23.2f %.2f\n",
interest_rate,percent,monthly_payment,total_payment);
         
      }
      while(interest_rate <= 8.0);
回复

使用道具 举报

发表于 21-9-2008 12:28 AM | 显示全部楼层
原帖由 skyblueyin 于 20-9-2008 09:00 PM 发表
谢谢你!这是我做的,但答案有点怪。
int year = 5;
double interest_rate = 5;
double loan_amount = 10000;
double monthly_payment = 0;
double total_payment = 0;
char percent = '%';
      
Scanner  ...


int count = 0;
        do {
            interest_rate = (count * 0.125) + interest_rate;
            total_payment = year * (interest_rate/100 * loan_amount)+loan_amount;
            monthly_payment = total_payment / (year * 12);
            count=count+1;
            System.out.printf("%.3f %-10c %-23.2f %.2f\n", interest_rate,
                    percent, monthly_payment, total_payment);

        } while (interest_rate <= 8.0);

你的total payment错了
1)你算的利息要加上(loan amount)
2) 5% 的意思是 0.05, 所以你的利息要除100
回复

使用道具 举报

 楼主| 发表于 21-9-2008 04:39 PM | 显示全部楼层

回复 10# winmxaa 的帖子

那方程式是老师给的,我也觉得有点怪怪。
这是什么意思:%-10c?
回复

使用道具 举报

发表于 21-9-2008 10:37 PM | 显示全部楼层
原帖由 skyblueyin 于 21-9-2008 04:39 PM 发表
那方程式是老师给的,我也觉得有点怪怪。
这是什么意思:%-10c?


这是tab的东西,这个没问题!
回复

使用道具 举报

 楼主| 发表于 24-9-2008 07:53 PM | 显示全部楼层
谢谢你们!!!!!!!!!!!
回复

使用道具 举报

发表于 25-9-2008 02:02 AM | 显示全部楼层
自己的assignment post上来叫人做吗?
下次你就会后悔因为我以前也是叫人帮我做现在不会做。。。
回复

使用道具 举报

发表于 1-10-2008 03:57 AM | 显示全部楼层
编程嘛。。
个人觉得Language/Syntax 在其次,重要的是Logic/algorithm
1. 先做分析
        - 2个 user inputs (Loan amount & Loan period)
        - 2 Fomulae required (get monthly payment & total payment)
2. Flow & Logic
function total payment = ($loan amount * rate% * loan period) + loan amount
function montly payment = total payment/load period/12

Get Loan amount
Get Loand Period
Loop and display Loan detail with the rate of 5% to 8% (incremental of 1/8)
Display Rate, Monthly Payment, Total Payment
End loop

3. 把以上的Logic写成Code就可以了

曾经我就经常帮我的同学做作业
最后导致他在考场不会作答,结果重读
我帮他,但也害了他
如果当时我没帮他,也许他自己就会尽力尝试
考试就不会不及格了
编程是需要锻炼和实习的
回复

使用道具 举报

发表于 28-10-2008 05:47 PM | 显示全部楼层
你们讲的对, 不过,我很奇怪,就是那些senior也有说做多点练习就懂了。。。
其实, 我要说不懂也不是,但也不可以说我很懂。。。
我很想精通在这一方面,不过不懂应该如何IMPROVE....
请问你们可以分享一下吗???
谢罗。。。。
回复

使用道具 举报


ADVERTISEMENT

发表于 28-10-2008 09:07 PM | 显示全部楼层
原帖由 KuKuBirds 于 25-9-2008 02:02 AM 发表
自己的assignment post上来叫人做吗?
下次你就会后悔因为我以前也是叫人帮我做现在不会做。。。


你是IT的????????
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 23-12-2025 02:16 AM , Processed in 0.157269 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表