Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need with coming up with a program to do what its asking! Help! I need to use

ID: 3641458 • Letter: I

Question

I need with coming up with a program to do what its asking! Help!


I need to use turtle graphics to draw a simple slogan in all upper case letters. Turtle graphics is a simple model for graphics programming in which you have a “turtle” that can turn left or right and can move forward. A turtle also has a pen, which it can lift up or place, point down, on the virtual paper. When the pen is down, the turtle draws a line as it moves forward. When the pen is up, no line is drawn. Your task is to draw :

To do this, please retrieve the TurtleGraphics.jar file from the course web site. Place this in your BlueJ “Projects” directory. In BlueJ, go to Preferences/Libraries. Select “Add”, choose the TurtleGraphics.jar file, and click Ok. Restart BlueJ. You now have installed a simple turtle graphics programming environment.
A simple turtle graphics program

Turtle graphics only has a few methods; the following program illustrates many of them:

public class Polygon {

    private static final int sides = 12;

    public static void main(String[] args) {
        double angle = 360.0 / sides;
        double step  = Math.sin(Math.toRadians(angle/2.0));   // sin(pi/N)
        Turtle turtle = new Turtle(0.5, 0.0, angle/2.0);
        turtle.penDown(); // We draw right from the starting point
        for (int i = 0; i < sides; i++) {
            turtle.goForward(step);
            turtle.turnLeft(angle);
        }

    }
}
Available turtle graphics methods are:

Turtle(double x0, double y0, double a0)
The turtle constructor will initialize the turtle with a location of (x0,y0) and an initial angle of a0 degrees (where zero degrees is facing rightward, i.e., along the positive x axis, and positive angles indicate counterclockwise orientation from zero.
turnLeft(double delta)
Turn counterclockwise delta degrees.
turnRight(double delta)
Turn clockwise delta degrees.
goForward(double step)
Move forward the amount indicated by step.
pause(int t)
Pause t milliseconds.
setPenColor(Color color)
Set the pen color. If you want a particular color, you can first try Color.COLORNAME (for example, Color.RED). If that doesn’t work, you can always do new Color(R, G, B), where the R, G, and B are replaced with red, green and blue values (integers).
setPenRadius(double radius)
Sets line thickness (default is 0.002).
setCanvasSize(int width, int height)
Set the size of the drawing window, in pixels (default is 512x512).
setXscale(double min, double max)
Set the drawing area’s internal x coordinate system (default is 0.0 to 1.0).
setYscale(double min, double max)
Set the drawing area’s internal y coordinate system (default is 0.0 to 1.0).
penDown()
Place the pen down on the virtual paper (ready to draw; default is pen up).
penUp()
Lift the pen from the virtual paper; movement won’t draw anything (this is the default).
Statement of Work

Use the Polygon program above as boilerplate (just take out the lines of code that are specific for polygons) for your own Program1.java file and class that draws the required text in all caps. Remember to adhere to all of our class guidelines for code quality; you will be graded on that, too. You may find it useful to draw characters by hand first to figure out simple but readable glyphs for each. Remember that you can get your program working a little bit at a time. Use static final constants to define things such as character heights, character spacing (vertical and horizontal), etc.
Submit your Program1.java file, a screenshot of your program’s graphical output, and a brief description of your program’s state of operation and any troubles or frustrations you had in this assignment (or any questions you have, though hopefully you already asked those in class). All this should go to the class Catalyst Collect It area.

Explanation / Answer

public class Slogan {

public static void main(String[] args) {
//You can play around with the numbers
double max = 50.0;
setXscale(0,max);
setYscale(0,max);
//makes a 50x50 grid
double step = 2; //step size
Turtle turtle = new Turtle(1.0, 10.0, 90.0); //make the turtle facing up
turtle.penDown(); // We draw right from the starting point

//Make an "H"
turtle.goForward(step*4); //make first line
turtle.turnLeft(180;) //reverse
turtle.goForward(step*2);
turtle.turnLeft(90); //point right
turtle.goForward(step*3); //Make horizontal line
turtle.turnLeft(90);
turtle.goForward(step*2);
turtle.turnLeft(180);
turtle.goForward(step*4); //Finish the "H"

//Move to next letter
turtle.penUp();
turtle.turnLeft(90);
turtle.goForward(step*2);
turtle.turnLeft(90);
turtle.penDown();

//Make an "I"
turtle.goForward(step*4);

//Move to S
turtle.penUp();
turtle.turnRight(90);
turtle.goForward(step*3);
turtle.penDown();

//S
turtle.goForward(step*2);
turtle.turnRight(180);
turtle.goForward(step*2);
turtle.turnLeft(90);
turtle.goForward(step*2);
turtle.turnLeft(90);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*2);
turtle.turnRight(180);
turtle.goForward(step*2);

//to T
turtle.penUp();
turtle.goForward(step*4);
turtle.turnLeft(90);
turtle.penDown();

//T
turtle.goForward(step*4);
turtle.turnLeft(90);
turtle.goForward(step*2);
turtle.turnRight(180);
turtle.goForward(step*4);

//to I
turtle.penUp();
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.penDown();

//I
turtle.goForward(step*4);

//to B
turtle.turnLeft(90);
turtle.penUp();
turtle.goForward(step*2);
turtle.penDown();

//B
turtle.turnLeft(90);
turtle.goForward(step*4);
turtle.turnRight(90);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*1);
turtle.turnRight(180);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*2);
turtle.turnRight(180);
turtle.goForward(step*2);

//to E
turtle.penUp();
turtle.goForward(step*2);
turtle.penDown();

//E
turtle.goForward(step*2);
turtle.turnRight(180);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*2);
turtle.turnRight(180);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*2);

//to R
turtle.penUp();
turtle.goForward(step*2);
turtle.penDown();

//R
turtle.goForward(step*3);
turtle.turnRight(90);
turtle.goForward(step*2);
turtle.turnRight(90);
turtle.goForward(step*1);
turtle.turnLeft(90);
turtle.goForward(step*3);
turtle.turnRight(90);
turtle.penUp();
turtle.goForward(step*2);
turtle.penDown();
turtle.turnRight(90);
turtle.goForward(step*3);
turtle.turnRight(180);
turtle.goForward(step*1);
turtle.turnLeft(90);
turtle.goForward(step*3);

//done
turtle.penUp();
turtle.goForward(step*3);

}
}