Complete the implementation of the class, JAVA Programming

Assignment Help:

The class TurtleQTwo extends Turtle by adding one new method, plus, which is specified below. (All other features of TurtleQTwo are the same as for Turtle.)

method plus(n in Int) state change pre n ≥ 1.

post The marker state of the receiver is not changed. But the pen state becomes "on" and the diagram of the receiver is changed as follows:

Four spots are added, one n places to the right of the current marker position; one n places above the current marker position; one n places to the left of the current marker position; one n places below the current marker position.

If the receiver has pen state "on", then a spot, is also added to the diagram at the marker position of the receiver. ( T h i s is not added if the receiver h as pen state "off".) After execution of plus the pen s t a t e of the receiver is "on". Other features of the receiver are not changed.

For example, if plus(3) is applied to a turtle whose marker is at (5,5) and whose pen state is "off", then it will add the spots shown in Figure to the diagram (leaving the marker state; unchanged and the pen state "on")

2100_complete the implementation of the class.png

(a) Partial code for the implementation of the class

TurtleQTwo is given below. Class TurtleQTwo
{
this.plus calls plusTurtleQTwo
}
// (1)

// (2)
}

method plusTurtleQTwo(n)
{

Show how to complete the implementation of the class by giving code to be added at (1) and (2) above.

(b) This part of the question asks you to use the WorkPad to test your implementation of TurtleQTwo and its method plus.


Related Discussions:- Complete the implementation of the class

Big m method, i''ve done an application that calculates simplex methods i n...

i''ve done an application that calculates simplex methods i need to add big m method can any one help me?

I need a website to do online marketing, I need a website to do online mark...

I need a website to do online marketing Project Description: Develop a website designer/developer to develop a website from scratch. This website has to be written in Java an

What should be public and private, What should be public? What should be pr...

What should be public? What should be private? As a rule of thumb: Classes are public. Fields are private. Constructors are public. Getter and setter methods

Program a pong game using rmi, Using RMI, program a PONG game that enables ...

Using RMI, program a PONG game that enables two users to play against one another. Pong class: package graphics;/* * Copyright (c) 2006, Your Corporation. All Rights Reserved. */

Javascript validarion, 1. Obtaining the new script: Download and save the a...

1. Obtaining the new script: Download and save the attached comment CGI mailer script form-mail2.pl to your server''s cgi-bin directory, and change the permissions on the script to

File I/O, Write a program that reads both the girl and boy files into memor...

Write a program that reads both the girl and boy files into memory using arrays. Then, allow the user to input a name. The program should search through both arrays. If there is

Admin panel to upload my html and psd templates, Admin panel to upload my h...

Admin panel to upload my html, php, psd templates Project Description: -Upload my psd file and convert -Login panel -Client login panel -Encryption code -Send dem

I want hall rental website, I want Hall Rental Website Project Descripti...

I want Hall Rental Website Project Description: I want to prepare website for my party venue where i will post the photos and detail of place along with availability calendar

Regex , Having trouble with a lab, need to

Having trouble with a lab, need to

Advantage of event-delegation over event-inheritance model, Describe advant...

Describe advantage of the event-delegation model over the earlier event-inheritance model ?

Write Your Message!

Captcha
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