Computer Science Courses
Related sites
HW 1 |
A simple example of a question that you might ask of a computer is
How many years does it take to accumulate $20,000 in a bank accountif you start with $10,000 and interest is fixed at 5% compounding annually?
Code up and run a program to solve this problem.
HINT: Draw up a table of your bank balance after 1 year, 2 years andso on:
Year Balance ($)0 10,0001 10,000 + 0.05*(10,000)2 Year 1 balance + 0.05*(Year 1 balance) 3 Year 2 balance + 0.05*(Year 2 balance) ... ... ...
You could write a program to print this output and then run it for, say, 10 years. You could then decide how you might write a program which will find out how many years you would need to accumulate $20,000.
Note that you will need to use a loop to write thisprogram. Because we may not have yet covered this in lectures, youmay wish to wait a little, or learn it on your own (in the text book,or in the lecture slides, or in Java Tutorial).
You will get up to two marks, if you present a solution to the Homeworkexercise during the next week lab.
HW 1 |
Updated: Sun 12 Jun 2016 17:27:37 AEST • Responsible Officer: JavaScript must be enabled to display this email address. • Page Contact:
+61 2 6125 5111
The Australian National University, Canberra
CRICOS Provider : 00120C ABN : 52 234 063 906