Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Explain the highlighted part. Like a step-by-step process of completing the requested task. Part 1 Most of part 1 will consist of refactoring the code
Explain the highlighted part. Like a step-by-step process of completing the requested task.
Part 1 Most of part 1 will consist of refactoring the code to improve its implementation. Part 1: Setting the turtle size when it is instantiated 1. Currently, a turtle is created and given a default size of 20. To change the size of the turtle its increase Turtle Size By5 and decrease Turtle Size By5 methods can be called. Add functionality so that a turtle can be created with a specified size. In the Doodle Turtle class do the following: a. Overload the Doodle Turtle constructor by creating a one-parameter constructor that takes the size of the turtle as an integer. b. Add an empty method body. c. Complete the method specification for the new constructor. The default constructor method specification can be used as a model. The only difference will be that the getTurtleSize() will equal the name of the size parameter instead of INITIAL_SIZE. d. In the method body of the one-parameter constructor do the following in this order: i. Call the initializeWithDefaultValues helper method. ii. Call the setSize method passing it the size parameter. e. Compile the program and fix any compilation errors before continuing. 2. With the new one-parameter constructor that takes the size of the turtle, we can modify the instantiation of the turtles. In the Gui class in the edu.westga.cs1301.project1.view package. Do the following: a. In the Gui constructor, for the instantiation of the first turtle replace the call to the Doodle Turtle default constructor with a call to the one-parameter constructor and pass in a size of 30. b. Do the same for the second turtle but give it a size of 15. 3. In the Doodle Controller default constructor do the following: a. The size of the turtles no longer need to be changed, so delete the method calls to increase and decrease the size of the big and little turtle, respectively. b. Modify the @param description for big Turtle to say the bigger of the two turtles and likewise for the little Turtle parameter to say the smaller of the two turtles. 2 of 12
Step 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