Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

LetterTurtle Initials Assignment: Drawing Your Initials with Java, Assignments of Computer Science

A bonus homework assignment for a java programming class, where students are required to write methods to draw their initials using the letterturtle class. The assignment includes instructions on handling repeated letters and drawing shapes, as well as important notes on method headers, creating a world, and hiding letterturtles. The deadline for submission is june 8, 2008.

Typology: Assignments

Pre 2010

Uploaded on 08/04/2009

koofers-user-yn5
koofers-user-yn5 🇺🇸

1

(1)

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download LetterTurtle Initials Assignment: Drawing Your Initials with Java and more Assignments Computer Science in PDF only on Docsity!

Bonus HW 1: Drawing Initials with LetterTurtle

DUE DATE: Sunday June 8, 2008

For this bonus assignment, you will be required to draw the first letters of your first, middle, and last names in a class called LetterTurtle(start with the provided LetterTurtle).

The Initials

You will be expected to draw the first letters of your first, middle, and last names, which will henceforth be referred to as your initials for the purposes of this homework. For me, Katie Anna Long, this means that I should draw the letters “KAL” to receive credit. If your initials contain multiple instances of the same letter, you must instead choose a short word that has atleast three different letters in it (such as EAT, ISYE, or SET). If your initials have no repeated letters, you must write your initials.

The Shape of the Letters

We realize the difficulty of creating letters that have curves such as D, O, S, B to name a few. Those with initials that have curves may draw the “block” or “square” versions of the curved letters instead.

Method Header

You must write a separate method for each letter. The methods should take in a starting integer x coordinate and starting y coordinate. How the starting coordinates will correspond to your letter is up to you, but will need to be detailed in your comments. The minimum requirement will be for both methods to be void, but non-void methods are also acceptable.

For example, the methods I would have to write would be something akin to the following:

public void drawK(int x, int y) { //Method body in here }

public void drawA(int x, int y){ //Method body in here }

public void drawL(int x, int y){ //Method body in here }

Other Important Notes

You will be required to draw your letters on a World (similar to what we did for the in- class TurtleToys class). To write your initials at specific coordinates, look in the SimpleTurtle class for a constructor that takes in two integer coordinates and a Picture (this will be your World). o Hint: You might find it useful to create a different Turtle for each letter. To make the drawing easier to see, you need to change the Pen width of the LetterTurtle to something other than the default width of 1 (look in the SimpleTurtle class to determine how to do this). The final resulting drawing cannot contain any visible LetterTurtles (look in the SimpleTurtle class to determine how to do this). Be sure to include a main method, such that when I type ‘java LetterTurtle’ in the interactions pane, a world pops up that displays your initials (or a short word, in the case where one of the letters in your initials is repeated).

Reminders:

This homework is extra-credit (although not necessarily worth a full homework), and hence is not required. If you’re code does not compile, you will receive a zero for the assignment Make sure to turn in the .java file, NOT the .java~ or the .class files You must comment your code (you will lose a substantial number of points if you do not) You will lose points if you do not put your name, T-Square log-in, and a collaboration statement at the top of all files.

What to Turn In

LetterTurtle.java