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% 37
but for rates up to 8.0% (in increments of 0.1 percent, as shown in the above example).
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.
Have Triangle state that it implements the Drawable interface,
hence has a drawOn(Graphics2D g) method.
(Reminder: when you create the class in Eclipse, next to
Interfaces, choose Add... and type Drawable.)
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 Triangles 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:
Triangles, and
Triangles.
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.