Write a program to plot the string "HELLO", using only lines and circles. Do not call drawString, and do not use System.out. Make classes LetterH, LetterE, LetterL, and LetterO.

Here is a sample program output:

.

Complete the following files:

LetterE.java

LetterH.java

LetterO.java

Use the following files:

HelloComponent.java

import javax.swing.JComponent;
import java.awt.Graphics;
import java.awt.Graphics2D;

/**
   A component that draws "HELLO".
 */
public class HelloComponent extends JComponent
{
   public void paintComponent(Graphics g)
   {
      Graphics2D g2 = (Graphics2D) g;

      LetterH h = new LetterH(5, 5);
      h.draw(g2);

      LetterE e = new LetterE(40, 5);
      e.draw(g2);

      LetterL l1 = new LetterL(75, 5);
      l1.draw(g2);

      LetterL l2 = new LetterL(110, 5);
      l2.draw(g2);

      LetterO o = new LetterO(145, 5);
      o.draw(g2);
   }
}

HelloViewer.java

import javax.swing.*;

/**
   A frame that shows the letters HELLO, drawn from
   lines and an ellipse.
 */
public class HelloViewer
{
   public static void main(String[] args)
   {
      JFrame frame = new JFrame();

      frame.setSize(200, 100);
      frame.setTitle("HELLO");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      HelloComponent component = new HelloComponent();
      frame.add(component);

      frame.setVisible(true);
   }
}

LetterL.java

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;

/**
   A letter L shape.
*/
public class LetterL
{
   private double x;
   private double y;

   /**
      Constructs a letter L at the given x and y coordinate.
      @param x the x-coordinate of the top left corner
      @param y the y-coordinate of the top left corner
   */
   public LetterL(double anX, double aY)
   {
      x = anX;
      y = aY;
   }

   /**
      Draws the letter L.
      @param g2 the graphics context
   */
   public void draw(Graphics2D g2)
   {
      Point2D.Double p1 = new Point2D.Double(x, y);
      Point2D.Double p2 = new Point2D.Double(x, y + 50);
      Point2D.Double p3 = new Point2D.Double(x + 30, y + 50);

      Line2D.Double vert = new Line2D.Double(p1, p2);
      Line2D.Double horiz = new Line2D.Double(p2, p3);

      g2.draw(vert);
      g2.draw(horiz);
   }
}