Question

In: Computer Science

Create a program in JAVA that displays a design or picture for someone in your quarantine...

Create a program in JAVA that displays a design or picture for someone in your quarantine household/group: a pet, a parent, a sibling, a friend. Make them a picture using the tools in TurtleGraphics and run your program to share it with them!

Use a pen object, as well as any of the shape class objects to help you create your design. You must use and draw at least 5 shape objects.

- You must use a minimum of 4 different colors in your design.

- You must pick up the pen at least once in your code.

- You must put down the pen at least once in your code.

A sample program is given below:

Solutions

Expert Solution

Answer:

Code:(In Python)

#turtle is a library of python

from turtle import *

speed(5)

def star():
turns=5
begin_fill()
while turns>0:
forward(25)

left(145)
turns=turns-1
end_fill()

# Grass
bgcolor("green")

# Sky
penup()
goto(-400, -100)
pendown()
color("black")
begin_fill()
for i in range(2):
forward(800)

left(90)
forward(500)
left(90)
end_fill()

# Moon
penup()
goto(-320, 225)
pendown()
color("white")
begin_fill()
circle(35)
end_fill()

# Cloud
penup()
goto(200, 200)
pendown()
color("white")
begin_fill()
circle(25)
end_fill()

penup()
goto(220, 240)
pendown()
begin_fill()
circle(25)
end_fill()

penup()
goto(230, 215)
pendown()
begin_fill()
circle(25)
end_fill()

penup()
goto(180, 225)
pendown()
begin_fill()
circle(25)
end_fill()

# House
penup()
goto(-100, -100)
pendown()
pensize(3)
color("red", "orange") # (stroke, fill)
begin_fill()
for i in range(4):
forward(170)

left(90)
end_fill()

# Chimney
penup()
goto(20, 130)
pendown()
color("red", "cyan")
begin_fill()
for i in range(2):
forward(40)
left(90)
forward(100)
left(90)
end_fill()

# Roof
penup()
goto(-127, 70)
pendown()
begin_fill()
for i in range(3):
forward(225)

left(120)
end_fill()

# Window 1
penup()
goto(0, 0)
pendown()
color("black", "white")
begin_fill()
for i in range(4):
forward(50)

left(90)
end_fill()

# Window 1 Cross - Horizontal Line
penup()
goto(0, 25)
pendown()
color("black")
forward(50)

# Window 1 Cross - Vertical Line
penup()
goto(25, 0)
pendown()
left(90)
forward(50)

# Window 2
penup()
goto(-80, 0)
pendown()
right(90)
color("black", "white")
begin_fill()
for i in range(4):
forward(50)
left(90)
end_fill()

# Window 2 Cross - Horizontal Line
penup()
goto(-80, 25)
pendown()
color("black")
forward(50)

# Window 2 Cross - Vertical Line
penup()
goto(-55, 0)
pendown()
left(90)
forward(50)

# Door
penup()
goto(-40, -97)
pendown()
right(90)
color("blue")
begin_fill()
for i in range(2):
forward(50)

left(90)
forward(80)
left(90)
end_fill()

# Door Handle
penup()
goto(-30, -60)
pendown()
color("black")
begin_fill()
circle(5)
end_fill()


# Stars
x = -350
y= 200

for i in range(0, 5):
penup()

goto(x, y)
pendown()
color("yellow")
star()
x = x+50

a = 200
b = 200
for i in range(0, 5):
penup()

goto(a, b)
pendown()
color("yellow")
star()
a = a+50

# Heading
penup()
goto(-50,270)
pendown()
color('white')
write('Quarantine Home', font=('Courier', 20,'bold'))
  
hideturtle()
exitonclick()

Explanation:

The colors can be changed according to the user and Name can also be changed.

OUTPUT:


Related Solutions

Objective: Create a program that displays a design or picture for someone in your quarantine household/group:...
Objective: Create a program that displays a design or picture for someone in your quarantine household/group: a pet, a parent, a sibling, a friend. Make them a picture using the tools in TurtleGraphics and run your program to share it with them! Use a pen object, as well as any of the shape class objects to help you create your design. You must use and draw at least 5 shape objects. You must use a minimum of 4 different colors...
Objective: CODE IN JAVA Create a program that displays a design or picture for someone in...
Objective: CODE IN JAVA Create a program that displays a design or picture for someone in your quarantine household/group: a pet, a parent, a sibling, a friend. Make them a picture using the tools in TurtleGraphics and run your program to share it with them! Use a pen object, as well as any of the shape class objects to help you create your design. You must use and draw at least 5 shape objects. You must use a minimum of...
Design a program that displays the following in Java: Enter the grades for an Essay: Grammer...
Design a program that displays the following in Java: Enter the grades for an Essay: Grammer (must be 30 or less): 40 Grammer (must be 30 or less): 26.3 Spelling (must be 20 or less): 17.4 Correct Length (must be 20 or less): 19 Content (must be 30 or less): 23.5 The recorded scores are: Grammer: 26.3 Spelling: 17.4 Correct Length: 19.0 Content: 23.5 Total score: 86.2 The grade for this essay is B
Create a program in java with the following information: Design a program that uses an array...
Create a program in java with the following information: Design a program that uses an array with specified values to display the following: The lowest number in the array The highest number in the array The total of the numbers in the array The average of the numbers in the array Initialize an array with these specific 20 numbers: 26 45 56 12 78 74 39 22 5 90 87 32 28 11 93 62 79 53 22 51 example...
Create your own Java program that has all three of these components in its design: Includes...
Create your own Java program that has all three of these components in its design: Includes file input OR file output (one of the two) Uses token-based processing of String, int, double, or boolean (your choice) Incorporates two additional methods in addition to the main() method: one that's a value-returning method, the other a void.
Write the code in Java: 1. Create a method that displays your name in the console....
Write the code in Java: 1. Create a method that displays your name in the console. This method is void and takes no parameters. Make an app that runs the method in response to a button press. 2. Create a version of the method in #1 that takes the text (String) to be displayed as a parameter. Allow the user to enter the text in a dialog box or text field and display that text in the console. Be sure...
Java Programming Write a program that displays the following pattern *                         *       &nbsp
Java Programming Write a program that displays the following pattern *                         *          *          * *          *          *          *          *          *          *          *          *          *          *          *             *          *          *          *          *                         *          *          *                                     * Printing Pattern A * ** *** **** ***** ****** ******* Printing Pattern B ******* ****** ***** **** *** ** * Printing Pattern C * ** *** **** ***** ****** *******
Write a Java program that reads a name and displays on the screen.
Write a Java program that reads a name and displays on the screen.
Write a simple java program that produces any text art ("ASCII art") picture. Your program can...
Write a simple java program that produces any text art ("ASCII art") picture. Your program can produce any picture you like, with the following restrictions: • The picture should consist of between 3 and 200 lines of output, with no more than 100 characters per line. • The code must use at least one for loop or static method but should not contain infinite loops.
Create a PowersTable application that displays a table of of powers. ( Java Programing )
Create a PowersTable application that displays a table of of powers. ( Java Programing )
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT