Practice with loops (while
, for
) in Java. Practice with debugging. More practice implementing classes based on a given specification.
In Eclipse, checkout the Iteration project.
Rates
that has the usual main method. That method should use a for
loop to 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%
(in increments of 0.1 percent, as shown in the above example). Use
an instance 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. Have Triangle implement a drawOn(Graphics2D g)
method.
TriangleDrawer
to create and draw
different instances of your new Triangle
class
(different locations and sizes). The main()
method is in PyramidSchemeMain
. TriangleDrawer
that takes a total
window height
and total window width
in pixels, and an integer rowCount
. Change TriangleDrawer
’s paintComponent()
method so it draws a pyramid of Triangle
s
as in the first figure below (in that figure, rowCount == 6
, but your program should work for any
reasonable value of rowCount
) You just have to draw the triangles that point up; the ones
that point down are an illusion.
You’ll need to:
Triangle
s, and Triangle
s at appropriate locations. Test your code by modifying PyramidSchemeMain as needed.
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. Remember, in all your code:
Here is the grading rubric for this assignment.
Turn in your programming work by committing it to your SVN repository.