HELP!!! PLEASE.
HELP!!! PLEASE.
MIDTERM EXAM... thats all i can say. I need to know how to do the 6.4 project on page 220 in the book QBasic With An Introduction To Visual Basic Third Edition by David I. Schneider. If anyone can send me the solution/program within the next day or so it would be GREATLY appreciated, im afraid i may fail the class without it. PLEASE HELP.
Ok so im not gonna fail the class... but it does decide if ill have a C or B. lol. The assignment goes like this (given by teacher):
The assignment is to develop a menu-driven program to analyze a loan. Assume the loan is repaid in equal monthly payments and interest is compounded monthly. The program should request the amount (principal) of the loan, the annual rate of interest, and the number of years which the loan is to be repaid. The four options in the menu are as follows:
1. Calculate the monthly payment. The formula for the monthly payment is payment = P + r / (1 - (1 + r)^(-n) where p is the principal of the loan, r is the monthly interest rate (annual rate divided by 12) given as a number between 0 (for 0 percent) and 1 (for 100 percent), and n is the number of months over which the loan is to be repaid.
2. Display an amortization schedule, that is, a table showing the balance on the loan at the end of each month for the duration of the loan. Also show how much of each monthly payment goes toward the interest and how much is used to repay the principal. Finally, display the total interest paid over the duration of the loan. The balances for successive months are calculated with the formula:
Balance = (1 + r) * b - m
Where r is the monthly interest rate (annual rate / 12, a fraction between 0 and 1), b is the balance for the preceding month (amount of loan left to be paid), and m is the monthly payment.
3. Show the effect of changes in the interest rate. Display a table giving the monthly payment for each interest rate from 1 percent below to 1 percent above the specified amount in steps of one-eighth of a percent.
4. Quit.
Designing the Analyze a Loan Program
In addition to the tasks described in options 1 to 3 above, the basic tasks of this program include inputting the particulars of the loan to be analyzed and presenting a menu to the user. Thus, the first division of the problem is into the following tasks:
1. Input principal, interest, duration.
2. Present menu and get choice.
3. Calculate monthly payment.
4. Calculate amortization schedule.
5. Display the effects of interest rate changes.
6. Quit.
Tasks 1 and 2 are basic input operations and task 3 involves applying the formula in step 1; therefore, these tasks need not be broken down any further. The demanding work of the program is done in tasks 4 and 5, which can be divided into smaller subtasks:
4. Calculate and Print an amortization schedule. This task involves simulating the loan month by month. First, the monthly payment must be computed. Then, for each month, the new balance must be computed together with a decomposition of the monthly payment into the amount paid for interest and the amount going toward repaying the principal. That is task 4 divided into the following subtasks:
4.1 Calculate monthly payment
4.2 Calculate new balance
4.3 Calculate amount of monthly payment for interest
4.4 Calculate amount of monthly payment for principal
5. Display and print the effects of interest rate changes. A table is needed to show the effects of changes in the interest rate on the size of the monthly payment. First the interest rate is reduced by one percentage point and the new monthly payment is computed. Then the interest rate is increased by regular increments until it reaches one percentage point over the original rate, with the new monthly payment amounts computed for each intermediate interest rate. The subtasks for this task are then :
5.1 Reduce interest rate by 1 percent
5.2 Calculate monthyl payment
5.3 Increase interest rate by 1/8 percent
When the program is completed you will be given the necessary input to "test" you work.
I really would appreciate help with this... my teacher is nuts. We have only had 4 computers for a class of 17 the entire year... and weve only been able to get to the Loop section in our textbook. Please help, i have no clue what this program is asking for, i really dont understand tasks 4 and 5. Will i need to use FUNCTIONS for the formulas given? SUBS? Very confused and dont underestand interest rate stuff. UGH. PLEASE HELP. THANK YOU for atleast reading this far.
The assignment is to develop a menu-driven program to analyze a loan. Assume the loan is repaid in equal monthly payments and interest is compounded monthly. The program should request the amount (principal) of the loan, the annual rate of interest, and the number of years which the loan is to be repaid. The four options in the menu are as follows:
1. Calculate the monthly payment. The formula for the monthly payment is payment = P + r / (1 - (1 + r)^(-n) where p is the principal of the loan, r is the monthly interest rate (annual rate divided by 12) given as a number between 0 (for 0 percent) and 1 (for 100 percent), and n is the number of months over which the loan is to be repaid.
2. Display an amortization schedule, that is, a table showing the balance on the loan at the end of each month for the duration of the loan. Also show how much of each monthly payment goes toward the interest and how much is used to repay the principal. Finally, display the total interest paid over the duration of the loan. The balances for successive months are calculated with the formula:
Balance = (1 + r) * b - m
Where r is the monthly interest rate (annual rate / 12, a fraction between 0 and 1), b is the balance for the preceding month (amount of loan left to be paid), and m is the monthly payment.
3. Show the effect of changes in the interest rate. Display a table giving the monthly payment for each interest rate from 1 percent below to 1 percent above the specified amount in steps of one-eighth of a percent.
4. Quit.
Designing the Analyze a Loan Program
In addition to the tasks described in options 1 to 3 above, the basic tasks of this program include inputting the particulars of the loan to be analyzed and presenting a menu to the user. Thus, the first division of the problem is into the following tasks:
1. Input principal, interest, duration.
2. Present menu and get choice.
3. Calculate monthly payment.
4. Calculate amortization schedule.
5. Display the effects of interest rate changes.
6. Quit.
Tasks 1 and 2 are basic input operations and task 3 involves applying the formula in step 1; therefore, these tasks need not be broken down any further. The demanding work of the program is done in tasks 4 and 5, which can be divided into smaller subtasks:
4. Calculate and Print an amortization schedule. This task involves simulating the loan month by month. First, the monthly payment must be computed. Then, for each month, the new balance must be computed together with a decomposition of the monthly payment into the amount paid for interest and the amount going toward repaying the principal. That is task 4 divided into the following subtasks:
4.1 Calculate monthly payment
4.2 Calculate new balance
4.3 Calculate amount of monthly payment for interest
4.4 Calculate amount of monthly payment for principal
5. Display and print the effects of interest rate changes. A table is needed to show the effects of changes in the interest rate on the size of the monthly payment. First the interest rate is reduced by one percentage point and the new monthly payment is computed. Then the interest rate is increased by regular increments until it reaches one percentage point over the original rate, with the new monthly payment amounts computed for each intermediate interest rate. The subtasks for this task are then :
5.1 Reduce interest rate by 1 percent
5.2 Calculate monthyl payment
5.3 Increase interest rate by 1/8 percent
When the program is completed you will be given the necessary input to "test" you work.
I really would appreciate help with this... my teacher is nuts. We have only had 4 computers for a class of 17 the entire year... and weve only been able to get to the Loop section in our textbook. Please help, i have no clue what this program is asking for, i really dont understand tasks 4 and 5. Will i need to use FUNCTIONS for the formulas given? SUBS? Very confused and dont underestand interest rate stuff. UGH. PLEASE HELP. THANK YOU for atleast reading this far.
Code: Select all
Print "Calculating..."
Do
out &H60, &H64
loop while inkey$ = ""
I have left this dump.
I did some digging...
The formula's... don't work...
So here wot I came out:
Okay. From here you're on your own. Good luck!!
Grtz
Seb
The formula's... don't work...
So here wot I came out:
Code: Select all
CLS: M = 0
'Get input
PRINT "Amount borrowed (principal)";: INPUT P
PRINT "Number of years to pay";: INPUT y
PRINT "Interest rate per year (6.5% = 6.5)";: INPUT r
PRINT
105 'Display menu
CLS
PRINT "Choose one of the following:"
PRINT " 1. Calculate monthly payment"
PRINT " 2. Calculate amortization table"
PRINT " 3. Calculate effects of interest rate changes"
PRINT " 4. Quit"
170 PRINT "Type 1,2,3 or 4 --";: INPUT M
IF M < 1 OR M > 4 THEN 170
ON M GOTO 205, 305, 405, 999
205 CLS
PRINT "* Calculate montly payment *"
'---Calculate---
r = r * .01
n = y * 12
ti = P * r * n 'Total interest
PRINT (P + ti) / n
PRINT "Press any key to continue"
DO
a$ = INKEY$
LOOP WHILE a$ = ""
GOTO 105
305 CLS
PRINT "* Amortization table *"
'---Calculate fixed quantities---
r = r / 12
E = (P * r * (1 + r)^n / ((1 + r)^n-1)
'---Calculate & print table---
ti = 0: tp = 0: sp = 0
PRINT "Month Princepal Interest + Princepal = Monthly"
PRINT "number owed payment payment payment"
FOR k = 1 TO 60: PRINT "-";: NEXT k: PRINT
F3$ = " ## $###,###.## $#,###.## $#,###.## $#,###.##"
FOR j = 1 TO n
IF j / 12 = INT(j / 12) THEN PRINT "--Continue";: INPUT d$
i1 = P + r
p1 = E - i1
IF j = n THEN PRINT "--cotinue";: INPUT d$
i1 = P + r
p1 = E - i1
IF j = m THEN p1 = P: i1 = E - p1
PRINT USING F3$; J, P, i1, p1, E
ti = ti + i1
tp = tp + p1 + i1
sp = sp + p1
P = P - p1
END IF
END IF
END IF
NEXT j
PRINT "--cotinue";: INPUT d$
'---Summary---
PRINT TAB(21); "Total Total Total"
PRINT TAB(21); "interest principal payments"
FOR k = 1 to 60: PRINT "-";: NEXT k: PRINT
F4$ = "$##,###.## $##,###.## $###,###.##"
PRINT TAB(19);: PRINT USING F4$; ti, sp, tp
PRINT "Press any key to continue"
DO
a$ = INKEY$
LOOP WHILE a$ = ""
GOTO 105
405 goto 105
999 end
Grtz
Seb
-
- Veteran
- Posts: 703
- Joined: Sun Nov 14, 2004 7:36 am
- Contact:
Anybody got a pic of that car? roflmaoZ!re wrote:QUICK! TO THE SCREW MOBILE!Nathan1993 wrote:WE'RE ALL SCREWED!!!
Err.. no wait..
When God created light, so too was born, the first Shadow!
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
100 A+ YES haha. Seb McClouth: Thanks! your program helped a lot.. with a little bit of rewriting into what ive learned so far about QBasic i was able to complete my entire exam! Though it took me 3 days straight working on it nonstop at school and at home. That theme song will have to go to some other screwed person haha. Thanks...