Java Reference
In-Depth Information
΢ Exercise P8.14. Place a BankAccount class in a package whose name is
derived from your e-mail address, as described in Section 8.9 . Keep the
BankAccountTester class in the default package.
΢΢T Exercise P8.15. Provide a JUnit test class BankTest with three test
methods, each of which tests a different method of the Bank class in
Chapter 7 .
΢΢T Exercise P8.16. Provide JUnit test class TaxReturnTest with three
test methods that test different tax situations for the Tax class in Chapter
5 .
΢G Exercise P8.17. Write methods
ȗ public static void drawH(Graphics2D g2,
Point2D.Double p);
ȗ public static void drawE(Graphics2D g2,
Point2D.Double p);
382
383
ȗ public static void drawL(Graphics2D g2,
Point2D.Double p);
ȗ public static void drawO(Graphics2D g2,
Point2D.Double p);
that show the letters H, E, L, O on the graphics window, where the point p
is the top-left corner of the letter. Then call the methods to draw the words
ȒHELLOȓ and ȒHOLEȓ on the graphics display. Draw lines and ellipses.
Do not use the drawString method. Do not use System.out .
΢΢G Exercise P8.18. Repeat Exercise P8.15 by designing classes LetterH ,
LetterE , LetterL , and LetterO , each with a constructor that takes
a Point2D.Double parameter (the top-left corner) and a method
draw(Graphics2D g2) .Which solution is more object-oriented?
Additional programming exercises are available in WileyPLUS.
Search WWH ::




Custom Search