Java: An Introduction to Problem Solving and Programming (7th Edition)
7th Edition
ISBN: 9780133766264
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 7.6, Problem 33STQ
Program Plan Intro
“strokePolygon” method:
- This method is one method of “GraphicsContext”.
- User can draw any polygon using “strokePolygon” method.
- Syntax of this method is
Objectname_of_GraphicsContext.strokePolygon(Array_of_xValues, Array_of_yValues, number_of_points)
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program that asks the user
for two points (x, y) and use them
to create two Point2D objects.
Then, use the methods in the
Point2D class to determine and
display the distance between the
two points and the midpoint
between the two points.
Write a program that will use WheelsFX shapes to create a Car. There is a size requirement; the Car should fit inside the box that appears on the start-up program. You will be able to change or refine your car over the next several assignments if you so choose. Be creative, your Car can also be something purely out of your imagination if you so choose.
Pick one of your shapes. In English, what will you need to do to take it from the default that we get when we create the shape to what you need to build that part of your Car?
Now take the shape that you wrote out in question 2 and now write what the Java code would be.
Pretend that you were writing this program in C++ instead of Java. Take the code you wrote in question three and now re-write it to look like it would in C++. For the object, you must use a pointer variable.
Looking at your answers for questions three and four, what differences do you see syntactically? What does this mean going forward for other objects we work with?
The…
How to create a program that does this in Jcreator / javafx
Chapter 7 Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
Ch. 7.1 - What output will be produced by the following...Ch. 7.1 - What output will be produced by the following...Ch. 7.1 - What output will be produced by the following...Ch. 7.1 - Consider the following array: int [] a = new...Ch. 7.1 - What is wrong with the following code to...Ch. 7.1 - Write a complete Java program that reads 20 values...Ch. 7.2 - Write some Java code that will declare an array...Ch. 7.2 - Rewrite the method displayResults of the program...Ch. 7.2 - What output will be produced by the following...Ch. 7.2 - Give the definition of a static method called...
Ch. 7.2 - Give the definition of a static method called...Ch. 7.2 - Prob. 12STQCh. 7.2 - The following method compiles and executes but...Ch. 7.2 - Suppose that we add the following method to the...Ch. 7.3 - Prob. 15STQCh. 7.3 - Replace the last loop in Listing 7.8 with a loop...Ch. 7.3 - Suppose a is an array of values of type double....Ch. 7.3 - Suppose a is an array of values of type double...Ch. 7.3 - Prob. 19STQCh. 7.3 - Consider the partially filled array a from...Ch. 7.3 - Repeat the previous question, but this time assume...Ch. 7.3 - Write an accessor method getEntryArray for the...Ch. 7.4 - Prob. 23STQCh. 7.4 - Write the invocation of the method selectionSort...Ch. 7.4 - How would you need to change the method...Ch. 7.4 - How would you need to change the method...Ch. 7.4 - Consider an array b of int values in which a value...Ch. 7.5 - What output is produced by the following code?...Ch. 7.5 - Revise the method showTable in Listing 7.13 so...Ch. 7.5 - Write code that will fill the following array a...Ch. 7.5 - Write a void method called display such that the...Ch. 7.6 - Prob. 33STQCh. 7 - Write a program in a class NumberAboveAverage that...Ch. 7 - Write a program in a class CountFamiles that...Ch. 7 - Write a program in a class CountPoor that counts...Ch. 7 - Write a program in a class FlowerCounter that...Ch. 7 - Write a program in a class characterFrequency that...Ch. 7 - Create a class Ledger that will record the sales...Ch. 7 - Define the following methods for the class Ledger,...Ch. 7 - Write a static method isStrictlyIncreasing (double...Ch. 7 - Write a static method removeDuplicates(Character[]...Ch. 7 - Write a static method remove {int v, int [] in}...Ch. 7 - Suppose that we are selling boxes of candy for a...Ch. 7 - Create a class polynomial that is used to evaluate...Ch. 7 - Write a method beyond LastEntry (position) for the...Ch. 7 - Revise the class OneWayNoRepeatsList, as given in...Ch. 7 - Write a static method for selection sort that will...Ch. 7 - Overload the method selectionSort in Listing 7.10...Ch. 7 - Revise the method selectionSort that appears in...Ch. 7 - Prob. 18ECh. 7 - Write a sequential search of an array of integers,...Ch. 7 - Write a static method findFigure (picture,...Ch. 7 - Write a static method blur (double [] [] picture)...Ch. 7 - Write a program that reads integers, one per line,...Ch. 7 - The following code creates a small phone book. An...Ch. 7 - Write the method rotateRight that takes an array...Ch. 7 - The following code creates a ragged 2D array. The...Ch. 7 - Write a program that will read a line of text that...Ch. 7 - Prob. 2PPCh. 7 - Add a method bubbleSort to the class ArraySorter,...Ch. 7 - Add a method insertionSort to the class...Ch. 7 - The class TimeBook in Listing 7.14 is not really...Ch. 7 - Define a class called TicTacToe. An object of type...Ch. 7 - Repeat Programming Project 10 from Chapter 5 but...Ch. 7 - Prob. 8PPCh. 7 - Write a GUI application that displays a picture of...Ch. 7 - ELIZA was a program written in 1966 that parodied...Ch. 7 - Prob. 11PPCh. 7 - Create a GUI application that draws the following...Ch. 7 - Practice Program 2 used two arrays to implement a...Ch. 7 - Practice Program 5.4 asked you to define Trivia...
Knowledge Booster
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
- Add the purple code to your Main Code Section (type it by hand if you get weird errors). It will call the object’s monitorLevels() method, which we will create in this sprint: userInput = 99while userInput != 0:checkerObj.displayList()userInput = checkerObj.displayMenu()if(userInput == 1):checkerObj.addLevel()checkerObj.writeLevelsToFile() # Write levelsList to LevelsFileelif(userInput == 2):checkerObj.removeLevel()checkerObj.writeLevelsToFile() # Write levelsList to LevelsFileelif(userInput == 3):checkerObj.removeAllLevels()checkerObj.writeLevelsToFile() # Write levelsList to LevelsFileelif(userInput == 4):checkerObj.updateMenuPrice() elif(userInput == 5):userInput = 0 # prevent the app from continuing if the user pressed Ctrl+C to stop itcheckerObj.monitorLevels()arrow_forwardYou will draw the multiple Zoogs by using for loop. Clear the display and start draw multiple Zoogs again when it reaches at the edge of the width. You can start from the assignment 3 and add for loop to draw multiple Zoogs. You need to do followings: 1. Need to declare frameRate(5). Otherwise, it will be too fast. 2. Zoog starts from a. zoogX= 80; b. zoogY= 130; 3. for drawing multiple Zoogs, a. increment ZoogX by 80; b. only 4 Zoogs are enough to show per displayarrow_forwardAn interesting GUI component in Java is the Slider. Indeed, sliders allow a user to specify a numeric value within a bounded range.Write a program in Java using sliders to simulate the measurement of the temperature in Celsius using a digital thermometer. The following must be achieved: Design the thermometer using an appropriate shape and include the slider inside the shape with tick marks. Use proper layout managers and containers. The thermometer will measure temperatures between -20 oC and 110 oC upon sliding the GUI slider component. The temperature will be displayed in a text field or label. Using another label, a message will be displayed when the temperature reaches a certain value. For example, at -20 oC, the message “It’s ice cold” is displayed, at +10 oC, the message “It’s quite cold” is displayed, at +35 oC, the message “It’s hot” is displayed, etc.arrow_forward
- Write a program that draws a fixed polygonwith points at (30, 10), (60, 30), (50, 70), (35, 35), and (10, 50). Wheneverthe mouse is moved, display a message indicating whether the mousepoint is inside the polygon at the mouse point or outside of it, as shown inFigure. To detect whether a point is inside a polygon, use the containsmethod defined in the Node class.arrow_forwardFor this task, you need to develop a JavaFX application in NetBeans that implements a LinkedHashMap class. The Java application should consist of a graphical user interface that can be used to add elements to the LinkedHashMap. There should be two TextFields to take in the element name and number. Then there should be four buttons to do four tasks, namely: add, change, remove and show all elements in the LinkedHashMap. Your buttons should have Action methods and should make use of methods in the LinkedHashMap class.When the Add button is clicked, the element name and value should be added to the LinkedHashMap. Make use of the LinkedHashMap methods to add the elements. When the user fills in the element name and number and the Add button is clicked, a message should be displayed in an alert dialog box to the user to inform them of this If no element is specified at the time the Add button is clicked, an error message should be displayed to inform the user to enter the elementarrow_forwardx = zeros(uint8(5,5)); for i = 1:5 for j = 1:5 a = 5/i; x(i,j) = 255/a; end end Which of the following best describes the black and white image x? 1. The columns of x will get lighter from left to right 2. The rows of x will get lighter from top to bottom 3. The rows of x will get darker from top to bottom 4. The columns of x will get darker from left to rightarrow_forward
- Using Java, solve the following problem using JavaFX: Write a program (Call the class ImageDisplay) that displays four images in a grid pane, as shown below. You are given 4 flags for the display, but you are free to choose other images. You are to use a GridPane for the layout. Also use ImageView. You will need to create an object for each image and use add method of GridPane to add an image to a specified row and column layout.arrow_forwardYou are to write a program that allows the user to draw a simple house using 5 mouse clicks. - The first two clicks will be the opposite corners of the rectangular frame of the house. - The third click will indicate the center of the top edge of the rectangular door. The door should have a total width that is 1/5 of the width of the house frame. The sides of the door should extend from the corners of the top down to the bottom of the frame. - The 4th click will indicate the center of a square window. The window is as wide as the door. (A change from the original book program.) - The last click will indicate the peak of the roof. The edges of the roof will extend from the point at the peak to the corners of the top edge of the house frame. Make the lines of the roof edge green. (Another change from the original book program.)arrow_forwardI'm learning GUI in my java class and we were asked to do this prompt.(we use netbeans and this assignment was with javafx I believe) Draw 2 circles, with their center x values as half of the scene width, and the first circle’s center y as 1/4 of the scene height, and the second circle’s center y as 3/4 of the scene height. You need to bind the circle center locations to the scene size. My code wasn't running so I just scraped the whole thing. Any help is appreciated. Thank you in advance!arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT