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

  Calculate the total hours of over lapping meetings

Suppose you have a meeting room which can hold multiple meetings and the smalled duration of meeting can be 30 mins. Calculate the total hours of over lapping meetings.

  Convert the following expression to postfix

Convert the following expression to postfix. ( 5 * ( ( 9 * 8 ) + ( 7 * ( 4 + 6 ) ) ) )

  The continual rise in popularity of php as a solution

Question: With the continual rise in popularity of PHP as a solution to e-commerce applications and the tendency to protect intellectual property, just how open do you think the future will be as far as Web application development is concerned? For t..

  Modify the java application using java netbeans ide

Modify the Java application using Java NetBeans IDE to meet these additional and changed business requirements. The application will now compare the total annual compensation of at least two salespersons.

  Compute the temperature in centigrade

Compute the temperature in Centigrade - Display the temperatures in both Centrigrade and Fahrenheit with appropriate labels, using the + operator to concatenate the labels with the variables

  Design and implement a basic graphical user interface

Design and implement a basic graphical user interface (GUI) program for recording information about a family tree -

  Write down the java code for the bank

Write down the java code for the bank of Fraud. User is presented with menu which looks something like this: 1. Deposit 2. Withdrawal 3. Check Balance 4. Exit.

  Write a test application name employeetest

Create two Employee objects and display each objects yearly salary. Then give each employee a 10% raise and display each employee's yearly salary again.

  Write a method called alldigitsodds that returns whether

write a method called alldigitsodds that returns whether every digit of a positive integer is odd. return true if the

  Write a java program

To become familiar with how infix expressions can be converted to postfix expressions.

  Class sorter which contains methods for selection sort

Write a class Sorter which contains methods for selection sort, insertion sort and bubble sort (start with the code below). Then create a client class which asks user to enter ten numbers using arrays. Then the program asks user which sorting algo..

  Create a java program

UserApp and PrettyPrintUtility multiple times (supplying different TransData test file names), the AutoTesterUtility PROGRAM will be the driver program.

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