Java code please 1. A Simple Game by CodeChum Admin You probably are fond of games. This quiz though is not that complicated. You are simply going to work with a point on a screen, and a circle on a screen as well. And let's consider them as the characters in the game. We are going to call both of these characters as Movable objects. Objects are said to be Movable if they can be moved around the screen. The following simple movements are allowed: public void moveLeft(); // moves the x to the left by 1 unit public void moveRight(); // moves the x to the right by 1 unit public void moveUp(); // moves the y 1 unit upward public void moveDown(); // moves the y 1 unit downward public void display(); // prints all the info about a Movable Both Point and Circle characters are Movable. The Point has an x coordinate and a y coordinate. The Circle has a Point (representing its center) and a radius (for our purpose this is an int). The attributes may all be set to public. It goes without saying that Point and Circle should implement all the methods of Movable since they are Movable objects. The screen where the characters are going to move around is a 2-dimensional screen with coordinates (0,0) as its top-left corner and (200,200) as its bottom-right corner. Make sure that when the characters are moving on the screen, they do not go out of the screen, especially with the Circle character since it has a radius involved. For the display() function, in Point, print Point: (x,y) and in Circle, print Circle: (x,y), r. Input The first input is either 1 (a Point) or 2 (a Circle). If it is a Point, 2 non-negative integers follow, if it is a Circle, 3 non-negative integers follow, the 3rd being the radius. Then a positive integer m is read representing the number of operations that have to be performed followed by the operations themselves. - 1 - moveLeft() - 2 - moveRight() - 3 - moveUp() - 4 - moveDown() 1 0·0 5 4 4 2 2 1 Output A single line simply printing the string returned by toString(). Point:·(1,2)
Java code please 1. A Simple Game by CodeChum Admin You probably are fond of games. This quiz though is not that complicated. You are simply going to work with a point on a screen, and a circle on a screen as well. And let's consider them as the characters in the game. We are going to call both of these characters as Movable objects. Objects are said to be Movable if they can be moved around the screen. The following simple movements are allowed: public void moveLeft(); // moves the x to the left by 1 unit public void moveRight(); // moves the x to the right by 1 unit public void moveUp(); // moves the y 1 unit upward public void moveDown(); // moves the y 1 unit downward public void display(); // prints all the info about a Movable Both Point and Circle characters are Movable. The Point has an x coordinate and a y coordinate. The Circle has a Point (representing its center) and a radius (for our purpose this is an int). The attributes may all be set to public. It goes without saying that Point and Circle should implement all the methods of Movable since they are Movable objects. The screen where the characters are going to move around is a 2-dimensional screen with coordinates (0,0) as its top-left corner and (200,200) as its bottom-right corner. Make sure that when the characters are moving on the screen, they do not go out of the screen, especially with the Circle character since it has a radius involved. For the display() function, in Point, print Point: (x,y) and in Circle, print Circle: (x,y), r. Input The first input is either 1 (a Point) or 2 (a Circle). If it is a Point, 2 non-negative integers follow, if it is a Circle, 3 non-negative integers follow, the 3rd being the radius. Then a positive integer m is read representing the number of operations that have to be performed followed by the operations themselves. - 1 - moveLeft() - 2 - moveRight() - 3 - moveUp() - 4 - moveDown() 1 0·0 5 4 4 2 2 1 Output A single line simply printing the string returned by toString(). Point:·(1,2)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Java code please
1. A Simple Game
by CodeChum Admin
You probably are fond of games. This quiz though is not that complicated. You are simply going to work with a point on a screen, and a circle on a screen as well. And let's consider them as the characters in the game. We are going to call both of these characters as Movable objects. Objects are said to be Movable if they can be moved around the screen. The following simple movements are allowed:
public void moveLeft(); // moves the x to the left by 1 unit
public void moveRight(); // moves the x to the right by 1 unit
public void moveUp(); // moves the y 1 unit upward
public void moveDown(); // moves the y 1 unit downward
public void display(); // prints all the info about a Movable
Both Point and Circle characters are Movable.
The Point has an x coordinate and a y coordinate. The Circle has a Point (representing its center) and a radius (for our purpose this is an int). The attributes may all be set to public.
It goes without saying that Point and Circle should implement all the methods of Movable since they are Movable objects.
The screen where the characters are going to move around is a 2-dimensional screen with coordinates (0,0) as its top-left corner and (200,200) as its bottom-right corner.
Make sure that when the characters are moving on the screen, they do not go out of the screen, especially with the Circle character since it has a radius involved.
For the display() function, in Point, print Point: (x,y) and in Circle, print Circle: (x,y), r.
Input
The first input is either 1 (a Point) or 2 (a Circle). If it is a Point, 2 non-negative integers follow, if it is a Circle, 3 non-negative integers follow, the 3rd being the radius. Then a positive integer m is read representing the number of operations that have to be performed followed by the operations themselves.
- 1 - moveLeft()
- 2 - moveRight()
- 3 - moveUp()
- 4 - moveDown()
1
0·0
5
4
4
2
2
1
Output
A single line simply printing the string returned by toString().
Point:·(1,2)

Transcribed Image Text:Expected
Point: (1,2)
Output
Test Case 2
Input
10 10 5
4
4
2.
2.
Your
No Output
Output
Expected
Output
círcle: (11,12), 5
Test Case 3
Hidden
Test Case 4
Hidden
REDMI NOTE 10

Transcribed Image Text:Custom Input
Output
Test Cases
Executions
CE Run Tests
Test Case 1
Input
4
2.
2
Your
No Output
Output
Expected
Output
Point: (1,2)
O Test Case 2
Input
10 10 5
REDMI NOTE 10
4.
身
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY