Write a method called drawspokes to draw the spokes

Assignment Help JAVA Programming
Reference no: EM13860256

Part A

As part of a package called Assign_3, write a Java class called Forest. For the first part, the class will draw a set of spokes on the display as shown below.

2257_img.png

Write a method called drawSpokes to draw the spokes. The method should take a double parameter that is the radius of the figure (i.e. the length of each spoke). There are 6 spokes, equally spaced around the center. To make Part B easier, make sure leave the turtle back where it started (i.e. at center facing right).

Part B

As the second part of the assignment, modify the Forest class written in Part A so that it draws a tree as seen below (the height is 80 and the canopy radius is 15).

523_img1.png

Write a method drawTree that draws the tree with a light gray trunk and a canopy. The method should take as parameters the height of the trunk and the radius of the canopy.

The trunk is a line drawn of specified height with pen width 10. The canopy is a set of spokes of the specified radius using a pen of width radius*2 using the method drawSpokes from Part A. The drawSpokes method should be modified to draw the spokes in green. Again, to make Part C easier, be sure to leave the turtle where it started.

Part C

As the third part of the assignment, modify the Forest class written in Part B so that it draws a forest of trees evenly spaced across the canvas as seen below:

1912_img2.png

Write a method drawForest that draws the trees using the method drawTree from Part B. The method takes as a parameter the number of trees to draw. Each tree has a randomly selected height between 40 and 100 and canopy radius between 10 and 20. The method is called with a random number of trees between 5 and 10. Use a FAST turtle.

Part D

As the final part of the assignment, modify the Forest class written in Part C so that it draws a forest in fall (i.e. some colored leaves) as seen below:

1787_img3.png

Write a method chooseColor that sets the pen color to green with a 75% probability and red with a 25% probability. Modify the drawSpokes method to call chooseColor rather than setting the pen color to green directly. To make the random selection of color, generate a random number between 0.0 and 1.0 (i.e. what random() returns). If the value is less than 0.75 choose green otherwise choose red. Suggestions:

• The separation into multiple methods with parameters as indicated is mandatory-for a good reason. Build up the program as outlined above rather than trying to get the final result. Procedural abstraction allows you to ignore the details of say how the tree is drawn, when writing the code to draw the forest.

• To make procedural abstraction effective, it is necessary to know where the turtle starts drawing and where it ends up after each method.

Reference no: EM13860256

Questions Cloud

Find the shape and dimensions of country : There are 20,000 hours of labor for country A. 5 hours of labor are required to produce 1 unit of S, while 4 hours are required to produce 1 unit of T. Find the shape and dimensions of country A's PPF.
Innovation is the strategy of innovating in emerging : Reverse Innovation is the strategy of innovating in emerging (or developing) markets and then selling these innovations in developed markets. Companies are developing products in emerging countries like China and India for global distribution. How wi..
How can supply chain management : How can Supply Chain Management (SCM) improve the Five Forces pressing in on the enterprise's room to produce excellent financial results and how can SCM have each effect that you describe, on the Five Forces?  Also please describe how the enterprise..
Distinctions between net ordinary-separately stated income : What are the distinctions between net ordinary income and separately stated income and deductions? What is the rationale for separately stating those items as individual K and the K-1?
Write a method called drawspokes to draw the spokes : Write a method drawForest that draws the trees using the method drawTree from Part B. The method takes as a parameter the number of trees to draw
Change in the total quantity produced : The change in the total quantity produced which results when one more worker is added to the production process is called
Does the government and big business control : To what extent in life can people make choices to suit us and our own good? Or does the government and big business control us, de facto, or not, (and to what extent)?
Composite index for housing construction costs : Prepare a composite (weighted) index for housing construction costs in 2008 with the following data:
Calculate the cost variance-schedule variance : Examine the following EVM data for the Acme project, a hypothetical construction project, to view information on the past and future performance: Calculate the cost variance (CV), schedule variance (SV), cost performance index (CPI), and schedule per..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd