Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Week 02: Homework 1 - Introductory Programming in Java Skip navigation Introductory Programming in Java ANU College of Engineering & Computer Science Search query Search ANU web, staff & maps Search COMP6700 Lectures Labs Assignments menu Search query Search ANU web, staff & maps Search Search COMP6700 labs Week 01: Welcome Week 02: Lab 1 Week 03: Lab 2 and HW 1 Week 04: Lab 3 and HW 2 Week 05: Drop-in Lab, HW 3 Week 06: Lab 4 and HW 4 Week 07: Mid-sem Exam Week 08: Free (Anzac Day) Week 09: Lab 5 and HW 5 Week 10: Lab 6 and HW 6 Week 11: Lab 7 and HW 7 Week 12: Lab 8 and HW 8 related sites Wattle Piazza Week 02: Homework 1 Growing money with loops The problem An example of a simple question that you might ask of a computer is “How many years does it take to accumulate $20,000 in a bank account if you start with $10,000 and interest is fixed at 5% compounding annually?” Code up and run a program to solve this problem. Remember that a Java program must contain at least one class declaration (and the name of this class must match the program name case-sensitively), which inside must include the main-method with prescribed modifiers and signature. HINT: Draw up a table of your bank balance after 1 year, 2 years and so on: Year Balance ($) 0 10,000 1 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 this program. Because we may not have yet covered this in lectures, you may wish to wait a little, or learn it on your own (in the text book, or in the lecture slides, or in Java Tutorial, The while and do-while Statements). Assessment You will get up to two marks, if you present a solution to the Homework exercise during the next week lab. Updated:  16 Feb 2017/ Responsible Officer:  Head of School/ Page Contact:  Alexei Khorev Contact ANU Copyright Disclaimer Privacy Freedom of Information +61 2 6125 5111 The Australian National University, Canberra CRICOS Provider : 00120C ABN : 52 234 063 906 You appear to be using Internet Explorer 7, or have compatibility view turned on. Your browser is not supported by ANU web styles. » Learn how to fix this » Ignore this warning in future