Question
Create a method int Turtle.java to draw a road pattern horizontally across the world. The method should take in two parameters, int height that designates
Create a method int Turtle.java to draw a road pattern horizontally across the world. The method should take in two parameters, int height that designates the top edge of the road, and int width that determines the distance between the edges of the road. The dashed lines in the center of the road should be of a length = to of the distance parameter. Center lines should be done with a while loop. The method should deal with errors. If the width is taller than the world, simply print an error and return. If the road drawn at a given y would attempt to draw off of the bottom of the world, the width of the road should be adjusted to fit in the world at the given starting y position.
Please help me!
Thanks in advance! :-)
#java programming
31. Create a method int Turtlejava to draw a "road'' pattern horizontally across the world. The method should take in two parameters. int height that designates the top edge of the road. and int width that determines the distance between the edges of the road. The dashed lines in the center of the road should be of a length F to of the distance parameter. Center lines should be done with a while loop The method should deal with errors. If the width is taller than the world, simply print an error and return. If the road drawn at a given y would attempt to draw off of the bottom ofthe world, the width of the road should be adjusted to fit in the world at the given starting y positionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started