ログインしてさらにmixiを楽しもう

コメントを投稿して情報交換!
更新通知を受け取って、最新情報をゲット!

C言語とC++言語コミュの英語なのですがこの課題に助けをください。

  • mixiチェック
  • このエントリーをはてなブックマークに追加
課題はこの以下です。
Your program will ask the user to enter the amount of
money they want to borrow, the interest rate, and the
monthly payment amount. Your program will then
determine how many months it will take to pay off that
loan, what the final payment amount will be, and how
much interest was paid over that time. If the monthly
payment amount isn't high enough to pay off more than
one month's interest, your program should notify the
user what the minimum monthly payment is.

Here are some examples of how your program should
behave. Please use the exact same test cases as these,
so that I can verify that your program works:

** Welcome to the Consumer Loan Calculator **

How much do you want to borrow? $1000
What is the annual interest rate expressed as a
percent? 18
What is the monthly payment amount? $50
Your debt will be paid off after 24 months, with a
final payment of just $47.83
The total amount of interest you will pay during that
time is $197.83

** Don't get overwhelmed with debt! **


** Welcome to the Consumer Loan Calculator **

How much do you want to borrow? $15000
What is the annual interest rate expressed as a
percent? 10
What is the monthly payment amount? $100
You must make payments of at least $126
Because your monthly interest is $125.00

** Don't get overwhelmed with debt! **


** Welcome to the Consumer Loan Calculator **

How much do you want to borrow? $-50
You must enter a positive number!
How much do you want to borrow? $-200
You must enter a positive number!
How much do you want to borrow? $20000
What is the annual interest rate expressed as a
percent? -2.5
You must enter a positive number!
What is the annual interest rate expressed as a
percent? 5
What is the monthly payment amount? $0
You must enter a positive number!
What is the monthly payment amount? $200
Your debt will be paid off after 130 months, with a
final payment of just $125.79
The total amount of interest you will pay during that
time is $5925.79

** Don't get overwhelmed with debt! **

Here are the rules and some tips:
○The user enters the interest rate as an annual
percentage rate. You need to convert this annual
percentage to a monthly decimal. For example, 12%
annual interest is 1% per month, which is 0.01
○Your program must allow only positive numbers to be
entered by the user, as shown above
○This program should mimic the standard way loans work for credit cards, car loans, and home mortgages: Each
month the following happens:
・The balance (amount owed) is multiplied times the
monthly interest rate to determine how much interest is owed this month. This amount of interest is added to
the principle (additional debt)
・This amount of interest is also added to the total
interest so far (to be output at end)
・The monthly payment is subtracted from the balance,
reducing the amount of debt.
・The month is counted (to be output at end)
This is repeated each month until the debt is paid off (balance reaches zero).
○Your program must notify the user if their monthly
payment isn't high enough, and tell them what the
minimum payment is to pay off one month's interest (and thus make progress paying off the debt).
○Your program must use at least 2 functions in
addition to main. At least one of these functions must
use a call-by-reference parameter These functions can
be of your choosing, but here are two ideas for
functions you could write for your program:
void get_input(double& principle, double& interest, double& payment);
/* This function asks the user to input the
principle, interest, and payment amount, and only
accepts positive numbers for input. All three
parameters are call-by-reference, so the function in
effect returns the three values by changing the values
of the arguments which are passed to it. The initial
values of these parameters are ignored and overwritten.
*/

double pay_off_loan(double principle, double rate,
double payment,int& months, double& total_interest);
/* This function assumes the payment is enough to
cover first month's interest. It has a loop to pay off the loan one month at a time.
Pre-Condition:
principle = starting principle.
rate = monthly interest rate expressed as a
decimal.
payment = amount of monthly payment, which
must be high enough to pay off the first month's
interest.
Post-Condition:
amount of final payment is returned by the
function.
months = number of months it took to pay off
loan.
total_interest = total amount of interest
paid during that time.
It may help to think of principle, rate, and
payment as input parameters, and months, and
total_interest
as output parameters.
*/

コメント(3)

あなたのプログラムは量を入れるユーザを尋ねるでしょう。
そして彼らが借りたがっているお金、金利。
毎月の支払い量。 あなたのプログラムはそしてそうするでしょう。
始める何カ月がそれを全部支払うか決定してください。
ローン、最終的な支払い量がどのくらいであるかということであり、およびどのように
その時、相当な関心を納入しました。 毎月です。
支払い量は、よりうまく行くことができる高くはありません。
1カ月の関心であり、あなたのプログラムに通知するはずです。
ユーザ、最小の毎月の支払いは何ですか?

いくつかの例がここにある、あなたのプログラムはそうするべきです。
振る舞ってください。 これらと全く同じテストケースを使用してください。
私が、あなたのプログラムが働くのを確かめることができるように:

** 消費者金融計算機**へようこそ

あなたはどれほど借りたいですか? $1000
aとして表された年間利子率はどのくらいです。
パーセント? 18
毎月の支払い量はどのくらいですか? $50
あなたの債務は24カ月後にaで返済されるでしょう。
ちょうど47.83ドルの最終的な支払い
あなたがそれの間に表す利息の総量
時間は197.83ドルです。

** 負債で、圧倒させないでください! **


** 消費者金融計算機**へようこそ

あなたはどれほど借りたいですか? $15000
aとして表された年間利子率はどのくらいです。
パーセント? 10
毎月の支払い量はどのくらいですか? $100
あなたは少なくとも126ドルの支払いをしなければなりません。
あなたの月利が125.00ドルであるので

** 負債で、圧倒させないでください! **


** 消費者金融計算機**へようこそ

あなたはどれほど借りたいですか? $-50
あなたは正の数を入れなければなりません!
あなたはどれほど借りたいですか? $-200
あなたは正の数を入れなければなりません!
あなたはどれほど借りたいですか? $20000
aとして表された年間利子率はどのくらいです。
パーセント? -2.5
あなたは正の数を入れなければなりません!
aとして表された年間利子率はどのくらいです。
パーセント? 5
毎月の支払い量はどのくらいですか? $0
あなたは正の数を入れなければなりません!
毎月の支払い量はどのくらいですか? $200
あなたの債務は130カ月後にaで返済されるでしょう。
ちょうど125.79ドルの最終的な支払い
あなたがそれの間に表す利息の総量
時間は5925.79ドルです。

** 負債で、圧倒させないでください! **

ここに、規則といくつかのチップがあります:
○ユーザは年次として金利を入れます。
割合レート。 あなたは、この年次に変換する必要があります。
毎月の小数への割合。 例えば、12%
1カ月あたり年利は1%です。(それは、0.01です)。
○必須が正の数だけは許容するあなたのプログラム
上に示されるようにユーザによって入られます。
○このプログラムはローンがクレジットカード、車のローン、および住宅ローンで働いている標準の方法をまねるべきです: それぞれ
以下が起こる月:
・バランス(未払額)は掛けられた回です。
どのくらいの関心が今月負われているかを決定する月利率。 興味があるこの量に加えられます。
原則(追加負債)
・また、興味があるこの量は合計に加えられます。
今までのところの関心(終わりの出力になる)
・毎月の支払いはバランスから引き算されます。
負債額を減少させます。
・月は数えられます。(終わりの出力になる)
債務が返済されるまで(バランスはゼロに達します)、これは毎月繰り返されます。
○あなたのプログラムがユーザに通知しなければならない、それら、毎月
支払いが十分高くなく、それらを言ってください、何
最低支払額は1カ月の関心を全部支払う(その結果、債務を返済しながら、進展してください)ことです。
○あなたのプログラムは中で少なくとも2つの機能を使用しなければなりません。
メインへの添加。 少なくともこれらの機能の1つはそうしなければなりません。
参照呼びパラメタThese機能缶を使用してください。
あなたが選ぶのがありますが、ここに、2つの考えがあります。
あなたがプログラムのために書くことができた機能:
空間で、_を入力します(ダブル、原則、ダブル、関心、ダブル、および支払い);
入力してくださいこの機能がユーザに頼む/*
原則、関心、および支払いが達する、唯一
入力の正の数を受け入れます。 すべての3
パラメタは参照呼びであり、そうは中の機能です。
効果は、値を変えることによって、3つの値を返します。
それに通過される議論について。 初期
これらのパラメタの値は、無視されて、上書きされます。
*/

_ローンで賃金_を倍にしてください。(二重原則、ダブルは評価します。
二重支払いとintと何カ月もの、二重で完全な_関心)
十分であるこの機能が支払いを仮定する/*
最初に、月の関心を隠してください。 それには、ローンで支払う輪が一度に1カ月あります。
プレ状態:
原則=始めの原則。
aとして表されたレート=月利率
10進。
毎月の支払いの支払い=量、どれ
高値が1カ月目に全部支払うために十分であったなら、そうしなければなりません。
関心。
ポスト状態:
最終的な支払いの量は返されます。
機能。
それが賃金に取った何カ月もの何カ月もの=数
貸与します。
興味がある合計_関心=総量
その時の間、支払います。
そしてそれが、原則を考えるのを助けるかもしれなくて、割合になってください。
そして入力パラメタとしての支払い、および何カ月も。
合計_関心
出力パラメタとして。
*/
関連記事:
http://mixi.jp/view_diary.pl?id=123031885&owner_id=339349

ログインすると、みんなのコメントがもっと見れるよ

mixiユーザー
ログインしてコメントしよう!

C言語とC++言語 更新情報

C言語とC++言語のメンバーはこんなコミュニティにも参加しています

星印の数は、共通して参加しているメンバーが多いほど増えます。

人気コミュニティランキング