Question: Repeat Exercise Graphics E8.23 by designing classes LetterH, LetterE, LetterL, and LetterO, each with a constructor that takes a Point2D.Double parameter (the top-left corner)

Repeat Exercise • Graphics E8.23 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?

Data from Exercise Graphics  E8.23

Write methods:

public static void drawH (Graphics2D g2, Point2D.Double p); public static void drawE

that show the letters H, E, L, O in 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.

••

public static void drawH (Graphics2D g2, Point2D.Double p); public static void drawE (Graphics2D g2, Point2D.Double p); public static void drawL (Graphics2D g2, Point 2D.Double p); public static void draw0 (Graphics2D g2, Point2D.Double p);

Step by Step Solution

3.32 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The exercise you are referring to suggests two different approaches to drawing letters using Javas Graphics2D The first approach is procedural where y... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!