Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 22, Problem 22.13PE
Program Plan Intro

Program to create the polygon through convex hull animation

Program Plan:

  • Import the required java packages.
  • Create the class named “Exercise22_13”,
  • In the main() function,
    • Declare the class “View” to draw and fill the color of rectangles.
    • Raise the event inside the rectangle to set the event by right clicking or left clicking the mouse.
    • Call the function drawNewPolygon() to draw the polygon with the respective points.
  • In the drawNewPolygon() method,
    • Retrieve all the points from the array list.
    • Execute the for loop to add the points inside the circle.
    • Clear the polygon.
    • If the size of the points is greater than 3, then find out the centre position of the co-ordinates of “x” and “y” and call the function getConvexHull() to add the array list of points.

Blurred answer
Students have asked these similar questions
(PLEASE USE JAVA AND JFRAME GUI) Game rules:The game consists of a two-dimensional field of size m × n (game field). Each element ofthe game field is a button with a number assigned to it.Initialization of the game:• The numbers on the buttons of the game field are set to a random digit between 0and 9• The target value is displayed above the game field• The current sum of the numbers displayed on the buttons of the game field is printedbelow the game field• The number of moves to completion is displayed in the upper right corner above thegame field.Playing:The first move is determined by the player by selecting any button (button A) on thegame field.1. The player is allowed to choose a second button (button B) located in the columnor row of the previously selected button (A).2. Upon selecting the second button (B), the value of button (A) is updated accordingto the following formula: A = (AoperationB)mod10.3. The operation for the basic game will be +.4. Decrement the number of moves…
python nMath: pentagonal numbers) A pentagonal number is defined as n(3n-1)/2 for n=1,2,..., and so on. So, the first few numbers are 1, 5, 12, 22, .... Write a function with the following header that returns a pentagonal number: def getPentagonalNumber(n): Write a test program that uses this function to display the first 100 pentagonal numbers with 10 numbers on each line.
PYTHON PROGRAMING : Code must only be in python.  A tic-tac-toe grid of size n is a grid composed of empty tiles bounded by solid lines. The grid is composed of n tiles in width and n tiles in height. Tic-tac-toe is usually played on a grid of size 3. We want to write a program to display on the console a tic-tac-toe grid of size n. Each tile has a certain width in number of characters (for example 6) and a certain height in number of lines (for example 3). Here is the expected output of the program for n = 3:                #            #             #            #             #            #####################             #            #             #            #             #            #####################             #            #             #            #             #            # You need to display a tic-tac-toe grid of size n = 3 that respects this exact display format, with tiles of size 6 x 3. It should be easy to modify your program to change n, the width and height of…

Chapter 22 Solutions

Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)

Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education