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

How you returning values from methods in java, How you Returning Values Fro...

How you Returning Values From Methods in java ? It's frequent meaningful to have a method return a value to the class which is known as it. This is accomplished through the ret

Functionality of customer relationship management system, The basic system ...

The basic system has to offer the following options: 1. Exit the program 2. Enter new customer The program prompts for the details of a new customer, assigns a unique cust

How dos attack is a cyber crime what cyber crime can be used, How DoS attac...

How DoS attack is a cyber crime? For what cyber crime can be used? DoS stands for Decline of Service and it is a cyber crime as it jams and within a few cases shut down the goa

Packages and interfaces, what are the advantages of packages and interface?...

what are the advantages of packages and interface? why we use them? and what is the way of using packages and interfaces complete description with examples?

Modify user profile class, Modify your UserProfile class to meet the follow...

Modify your UserProfile class to meet the following requirements: It must include a field called wall to store an ArrayList of wall posting objects. It must also provide

Queues, we can insert elements at rear and remove at front bt my question i...

we can insert elements at rear and remove at front bt my question is that how we insert at front in circular queue

I need java coding, I need Java coding Need to develop a website. Requir...

I need Java coding Need to develop a website. Require Java coder's urgently. Skills required: HTML, Graphic Design, Java, PHP, Website Design

I need basic mobile app, Project Description: Android app for particular...

Project Description: Android app for particular needs children Provide the fonts, layouts and images of the app. Functions: home screen: main page that links to 'login'

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