Question

In: Computer Science

Write a program named MyHometown_Icon.java. The program will be an application (i.e have a main method)....

Write a program named MyHometown_Icon.java. The program will be an application (i.e have a main method). It will be in the default package. It will import edu.wiu.StdDraw. Its main method will make calls to methods in StdDraw to draw something iconic about your hometown.

Multiple colors should be used.Multiple primitive types will be used and the drawing will consists of more than 20 primitive shapes.

Solutions

Expert Solution

import edu.wiu.StdDraw;

public class MyHometown_icon

{

public static void main(String args[])

{

stdDraw.setCanvas(500,500); //Set window size 500 pixel by 500

stdDraw.Clear(stdDraw.BLUE);//Set blue colour of sky

//draw green field

stdDraw.setPenColor(0,170,0);

stdDraw.filledRectangle(0.5,0.25,0.6,0.3);

//draw circular cloud at the mouse location as long as mouse is within bounds

while(true)

{

double cloudX=stdDraw.mouseX();

double cloudY=stdDraw.mouseY();

StdDraw.PenColor(StdDraw.WHITE);

if(cloudY>0.55)

{

stdDraw.filledCircle(cloudX,cloudY,0.005);

}

StdDraw.show(30);

}

// draw a blue diamond, radius 0.1 (old method)
    StdDraw.setPenRadius(); // default radius
    StdDraw.setPenColor(Colors.BOOK_BLUE);
    double[] x = {.1, .2, .3, .2};
    double[] y = {.2, .3, .2, .1};
    StdDraw.filledPolygon(x, y);

    // draw a cyandiamond, radius 0.1 (new method)
    StdDraw.setPenColor(Colors.CYAN);
    StdDraw.filledDiamond(.45, .2, 0.1);

    // draw a magenta triangle, radius 0.1
    StdDraw.setPenColor(Colors.MAGENTA);
    StdDraw.filledTriangle(.45, 0.4, 0.1);
 // Draw filled Square
    StdDraw.setPenColor(StdDraw.BLUE);
    StdDraw.filledSquare(5, 8, 2);

    // Draw Circle
    StdDraw.setPenColor(StdDraw.BLACK);
    StdDraw.setPenRadius();
    StdDraw.circle(5, 5, 2);

}

}


Related Solutions

Part I: Have a program class named TestArrays This class should have a main() method that...
Part I: Have a program class named TestArrays This class should have a main() method that behaves as follows: Have an integer array of size 10. Using a loop, fill the elements with increments of 5, starting with 5 in the first element. Using the array elements, sum the second, fifth and seventh elements. Display the sum with a label. Change the fourth element to 86. Subtract 9 from the ninth element. Using a loop, display the elements of the...
Java Programming Create a class named Problem1, and create a main method, the program does the...
Java Programming Create a class named Problem1, and create a main method, the program does the following: - Prompt the user to enter a String named str. - Prompt the user to enter a character named ch. - The program finds the index of the first occurrence of the character ch in str and print it in the format shown below. - If the character ch is found in more than one index in the String str, the program prints...
Write a complete Java program, including comments in each method and in the main program, to...
Write a complete Java program, including comments in each method and in the main program, to do the following: Outline: The main program will read in a group of three integer values which represent a student's SAT scores. The main program will call a method to determine if these three scores are all valid--valid means in the range from 200 to 800, including both end points, and is a multiple of 10 (ends in a 0). If the scores are...
Write a complete Java program, including comments in each method and in the main program, to...
Write a complete Java program, including comments in each method and in the main program, to do the following: Outline: The main program will read in a group of three int||eger values which represent a student's SAT scores. The main program will call a method to determine if these three scores are all valid--valid means in the range from 200 to 800, including both end points, and is a multiple of 10 (ends in a 0). If the scores are...
Write a complete Java program, including comments in both the main program and in each method,...
Write a complete Java program, including comments in both the main program and in each method, which will do the following: 0. The main program starts by calling a method named introduction which prints out a description of what the program will do. This method is called just once.      This method is not sent any parameters, and it does not return a value. The method should print your name. Then it prints several lines of output explaining what the...
Write a complete Java program, including comments in both the main program and in each method,...
Write a complete Java program, including comments in both the main program and in each method, which will do the following: 0. The main program starts by calling a method named introduction which prints out a description of what the program will do. This method is called just once.      This method is not sent any parameters, and it does not return a value. The method should print your name. Then it prints several lines of output explaining what the...
Write a complete Java program, including comments in both the main program and in each method,...
Write a complete Java program, including comments in both the main program and in each method, which will do the following: 0. The main program starts by calling a method named introduction which prints out a description of what the program will do. This method is called just once.      This method is not sent any parameters, and it does not return a value. The method should print your name. Then it prints several lines of output explaining what the...
Write a class called CheckUserName. CheckUserName must have a main method. Your program must ask for...
Write a class called CheckUserName. CheckUserName must have a main method. Your program must ask for a user name. If the name is on the list below (Liam, for example) greet the user saying: welcome back: Liam If the user is an admin (like Benkamin, for example) print: welcome back: Benjamin you have admin privileges Your program must accept upper case or lower case: emacs% java CheckUserName enter a user name: Liam welcome back: Liam emacs% java CheckUserName enter a...
Write a class called WhereIsMyNumber. WhereIsMyNumber must have a main method. Your program must ask for...
Write a class called WhereIsMyNumber. WhereIsMyNumber must have a main method. Your program must ask for a number (it must work if user enters numbers with decimal point of not). Then your program must print number is negative -- if humber is negative number in [0,10) -- if it is between 0 and 10, not including the 10 number in [10,100) -- if it is between 10 and 100, not including the 100 number in [100,1000) -- if it is...
Write a class called CheckUserName. CheckUserName must have a main method. Your program must ask for...
Write a class called CheckUserName. CheckUserName must have a main method. Your program must ask for a user name. If the name is on the list below (Liam, for example) greet the user saying: welcome back: Liam If the user is an admin (like Benkamin, for example) print: welcome back: Benjamin you have admin privileges Your program must accept upper case or lower case: emacs% java CheckUserName enter a user name: Liam welcome back: Liam emacs% java CheckUserName enter a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT