Boat



This is the first program we had to write in my class. What do you think?
//
// Project 1
//
// Programmer: Scott Lambert
//
// Date: 1/25/2005
//
// Purpose: To draw a boat using all of the following shapes:
// triangles, arcs, circles, ovals, rectangles, squares,
// lines and text. Must use three colors in addition
// to black and white.
//
// Note: Due to the length of the boat, I had to alter the applet
// to display on a screen sized 600x300. Also, I would
// like to credit the National Geographic article on the
// the Phoenician culture for the picture that I based this
// program off of. (Nat'l Geographic, Oct. 2004, "Who Were
// the Phoenicians?" Diagram: Merchant Mariners, pg.39)
//

import java.awt.*;
import java.applet.*;

public class Boat extends Applet
{
public void paint(Graphics g)
{
int i; // counter for loops

setBackground(Color.white);
g.drawString("Phoenician War Trireme", 20, 20);
g.drawString("Circa 300 B.C.",20,40);
g.drawString("Side Profile",20,60);
g.setColor(Color.blue); // Ocean
g.fillRect(0,250,600,50);
g.setColor(Color.red); // Rear arc
g.fillArc(25,150,100,100,95,265);
g.setColor(Color.yellow); // Rear arc
g.fillArc(35,155,90,70,100,260);
g.setColor(Color.white); // Rear arc
g.fillArc(40,160,90,55,105,255);
g.fillRect(70,150,20,20);
g.setColor(Color.yellow); // Staff
g.drawLine(68,213,74,140);
g.setColor(Color.orange);
g.drawLine(69,213,75,140);
g.setColor(Color.yellow);
g.fillOval(72,134,6,6); // Top of staff
g.setColor(Color.orange);
g.drawOval(71,133,7,7);
g.setColor(Color.yellow);
g.drawArc(72,125,7,7,150,240);
for(i=0;i<20;i++) // Horse head
{
g.drawLine(70,150,(70+i),160);
}
g.setColor(Color.orange);
g.fillOval(73,153,3,3); // Horse eye
g.setColor(Color.red); // Body
g.fillRect(70,225,470,25);
g.setColor(Color.yellow); // Body
g.fillRect(70,215,20,10);
g.drawLine(70,214,470,214); // Railing
g.setColor(Color.white); // White space
g.fillRect(70,200,400,14); // Above railing
g.fillRect(70,215,400,10); // Below railing
g.setColor(Color.black); // Bottom

for(i=0;i<30;i++) // Bottom rear
{
g.drawLine((70+i),250,100,260);
}
g.fillRect(100,250,370,11); // Bottom body

for(i=0;i<400;i=i+10) // Shields
{
g.setColor(Color.yellow);
g.fillOval((70+i),215,10,10);
g.setColor(Color.black);
g.drawOval((70+i),215,10,10);

}
g.setColor(Color.black);
g.fillArc(70,215,50,20,180,90); // Under railing
g.fillRect(95,225,375,10);
for(i=0;i<5;i++) // Bottom boat, front
{
g.drawLine(510,255,470,(255+i));
}
g.fillRect(470,250,60,5);
g.fillArc(445,215,50,20,270,90); // Black stripe, front
g.setColor(Color.yellow); // Eye in front
g.fillRect(471,214,35,11);
g.setColor(Color.white);
g.fillArc(474,206,18,18,180,90);
g.fillArc(474,216,18,18,0,90);
g.setColor(Color.red); // Iris
g.fillOval(479,216,9,9);
g.setColor(Color.black);
g.fillOval(481,218,5,5);
g.setColor(Color.white);

for(i=0;i<10;i++) // End of yellow stripe
{ // in front
g.drawLine(495,214,505,(214+i));
}

g.setColor(Color.yellow); // Trireme nose
g.fillRect(520,240,25,15);
g.setColor(Color.white);
g.fillArc(505,205,60,40,180,180);
g.setColor(Color.black);

for(i=0;i<400;i=i+15) // Portholes
{
g.fillOval((80+i),240,8,8);
}

for(i=0;i<375;i=i+15) // Oars
{
g.setColor(Color.yellow);
g.drawLine((95+i),227,(92+i),250);
g.setColor(Color.orange);
g.drawLine((96+i),227,(93+i),250);
}
// PHEW! I think I went a little overboard. Too ambitious???
}
}