Practice with loops (which
, for
) in Java. Practice with debugging. More practice implementing classes based on a given specification.
Iteration
project inside Eclipse. Use the SVN Repository Exploring
perspective to check out this project, then switch back to the Java
perspective.
Rates
using a for
loop that prints results like the following table: Rate Years to Double ---- --------------- 0.1% 694 0.2% 347 0.3% 232 0.4% 174 0.5% 139 0.6% 116 0.7% 100 0.8% 87 0.9% 78 1.0% 70 1.1% 64 1.2% 59 1.3% 54 1.4% 50 1.5% 47 1.6% 44 1.7% 42 1.8% 39 1.9% 37but for rates up to
8.0%
. Use instances of the provided Investment
class to do the calculation for each line of the table.
WhackABug
class contains several methods with bugs in them. Use the Java debugger in Eclipse to find the bug in each method. Add a comment to each method identifying the bug. Fix each bug.
Triangle
whose constructor takes x- and y-coordinates, a base width, and a height. Include a drawOn(Graphics2D g)
method, that draws an isoceles triangle as in the figure below. (You just have to draw the outline of the triangle, not the labels.) For testing, you can modify TriangleDrawer
to create and draw an instances of your new Triangle
. The main()
method is in PyramidSchemeMain
.
TriangleDrawer
that takes a total height
and width
in pixels, and an integer rowCount
. Change TriangleDrawer
’s paintComponent()
method so it draws a pyramid of Triangle
s as in the figure below for rowCount == 6
. (You just have to draw the triangles that point up; the ones pointing down are an illusion.)
You’ll need to:
Triangle
s, and
Triangle
s.
Enter the annual interest rate earned: 5.0 Enter the annual investment, or Q to quit: 100 New balance: 100.00 Enter the annual investment, or Q to quit: 50 New balance: 155.00 Enter the annual investment, or Q to quit: 100 New balance: 262.75 Enter the annual investment, or Q to quit: q Final balance: 262.75Other requirements:
main()
method in a class named RetirementPlan
.
AnnualInvestment
class to handle the calculations. This class’s constructor should take an annual interest rate. It should have an addAnnualInvestment(double amount)
method that calculates the annual interest earned and adds the given amount
to the investment.
AnnualInvestmentTest
, to test your AnnualInvestment
class. You might need to add method or methods to AnnualInvestment
to make it testable.
Turn in your programming work by committing it to your SVN repository.