efine an inner member class named bownkightPath which defines a moving path. The MovingPath is an abstract inner class which contains an abstract method. The hember class contains the following: A private int data field named interval which defines the number of intervals. The default value is 0. A private boolean data field named isDownward which defines the moving direction. The default value is true. A constructor which takes two integers as parameters and constructs a moving path with the given deltax and deltaY values. A method named move() which moves shapes. The method moves the outer class's shape downward by deltay pixels for 10 intervals, then move the shape to the boundary, the shape will then re-start at the top position (i.e. y=0). If the right hand corner of the shape reaches the right boundary, the shape will then re-start at th

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 5RQ
icon
Related questions
Question
Define an inner member class named DownRightpath which defines a moving path. The MovingPath is an abstract inner class which contains an abstract method. The DownRightPath class should extend the MovingPath and implement the move () method. The
member class contains the following:
• A private int data field named interval which defines the number of intervals. The default value is 0.
A private boolean data field named isDownward which defines the moving direction. The default value is true.
• A constructor which takes two integers as parameters and constructs a moving path with the given deltax and deltay values.
• A method named move () which moves shapes. The method moves the outer class's shape downward by deltaY pixels for 10 intervals, then move the shape to the right by deltax for 10 intervals and so on. If the bottom of the shape reaches the bottom
boundary, the shape will then re-start at the top position (i.e. y=0). If the right hand corner of the shape reaches the right boundary, the shape will then re-start at the left position (i.e. x=0).
Write the inner member class definition ONLY in the answer box below assuming that the abstract superclass Shape and the RectangleShape subclass are given. Note - keep a copy of your solution to this task because you will be extending it step by step in
subsequent tasks.
For example:
Test
Result
Rectangleshape ri = new Rectangleshape (18, 28, 50,100,500,68e, color.orange, PathType.DOWNRIGHT);
for (int i=0; i<11; i++) {
Color: java.awt.color[r=255,g=200, b=e]
Rectangle[x=10,y=25, width=5e, height=100]
Color: java.awt.color[r=255,g-200,b=e]
Rectangle[x=10,y=30, width=5e, height=100]
Color: java.awt.color[r=255,g-200, b=e]
Rectangle[x=10,y=35, width=50, height=100]
Color: java.awt.color[r=255,g-200, b=e]
Rectangle[x=10,y=48, width=5e, height=100]
color: java.awt.color[r=255,g=200, b=0]
r1.move(); r1.draw(painter);
Rectangle[x=10,y=45, width=5e, height=100]
color: java.awt.color[r=255,g=200, b=0]
Rectangle[x=10,y=5e, width=5e, height=100]
color: java.awt.color[r=255,g=200, b=0]
Rectangle[x=10,y=55, width=5e, height=100]
Color: java.awt.color[r=255,g-200, b=e]
Rectangle[x=18,y=68, width=50, height=100]
Color: java.awt.color[r=255,g-2e0, b=e]
Rectangle[x=18,y=65, width=5e, height=100]
Color: java.awt.color[r=255,g-200, b=e]
Rectangle[x=10,y=7e, width=5e, height=100]
Color: java.awt.color[r=255,g-200,b=e]
Rectangle[x=15,y=7e, width=5e, height=100]
Rectangleshape ri = new Rectangleshape(445,100, 50,100,500, 600, Color.orange, PathType.DOWNRIGHT); color: java.awt.color[r=255,g-200,b=e]
on (int i OLi 10L iu
Dostao-leLy ArA v 150 i dth re baigh+ 1001
Transcribed Image Text:Define an inner member class named DownRightpath which defines a moving path. The MovingPath is an abstract inner class which contains an abstract method. The DownRightPath class should extend the MovingPath and implement the move () method. The member class contains the following: • A private int data field named interval which defines the number of intervals. The default value is 0. A private boolean data field named isDownward which defines the moving direction. The default value is true. • A constructor which takes two integers as parameters and constructs a moving path with the given deltax and deltay values. • A method named move () which moves shapes. The method moves the outer class's shape downward by deltaY pixels for 10 intervals, then move the shape to the right by deltax for 10 intervals and so on. If the bottom of the shape reaches the bottom boundary, the shape will then re-start at the top position (i.e. y=0). If the right hand corner of the shape reaches the right boundary, the shape will then re-start at the left position (i.e. x=0). Write the inner member class definition ONLY in the answer box below assuming that the abstract superclass Shape and the RectangleShape subclass are given. Note - keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test Result Rectangleshape ri = new Rectangleshape (18, 28, 50,100,500,68e, color.orange, PathType.DOWNRIGHT); for (int i=0; i<11; i++) { Color: java.awt.color[r=255,g=200, b=e] Rectangle[x=10,y=25, width=5e, height=100] Color: java.awt.color[r=255,g-200,b=e] Rectangle[x=10,y=30, width=5e, height=100] Color: java.awt.color[r=255,g-200, b=e] Rectangle[x=10,y=35, width=50, height=100] Color: java.awt.color[r=255,g-200, b=e] Rectangle[x=10,y=48, width=5e, height=100] color: java.awt.color[r=255,g=200, b=0] r1.move(); r1.draw(painter); Rectangle[x=10,y=45, width=5e, height=100] color: java.awt.color[r=255,g=200, b=0] Rectangle[x=10,y=5e, width=5e, height=100] color: java.awt.color[r=255,g=200, b=0] Rectangle[x=10,y=55, width=5e, height=100] Color: java.awt.color[r=255,g-200, b=e] Rectangle[x=18,y=68, width=50, height=100] Color: java.awt.color[r=255,g-2e0, b=e] Rectangle[x=18,y=65, width=5e, height=100] Color: java.awt.color[r=255,g-200, b=e] Rectangle[x=10,y=7e, width=5e, height=100] Color: java.awt.color[r=255,g-200,b=e] Rectangle[x=15,y=7e, width=5e, height=100] Rectangleshape ri = new Rectangleshape(445,100, 50,100,500, 600, Color.orange, PathType.DOWNRIGHT); color: java.awt.color[r=255,g-200,b=e] on (int i OLi 10L iu Dostao-leLy ArA v 150 i dth re baigh+ 1001
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage