Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)
11th Edition
ISBN: 9780134671710
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 15.13, Problem 15.13.3CP
Explanation of Solution
Purpose of the USMap.java:
- The purpose of the code is to display the US map.
- The size of the map gets resized when the up and down is pressed in the key board.
- The UP arrow is used to enlarge the map.
- The DOWN arrow is used to shrink the map size.
- The map can be filled with color when the mouse buttons are pressed.
- When the primary button is pressed it fills red and when secondary button is pressed it fill blue and when the middle button is pressed it fill white color when it is clicked on every polygon that is created in the map.
Purpose of the line 21:
The purpose of the line is to perform a key event when a key press is made:
//set the action event
map.setOnKeyPressed(e ->
{
//condtion to validate the key UP
if (e.getCode() == KeyCode...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
in c++ code
Write in C++
Now, what if Sam wants to insert Eevee after Pikachu but he doesn't know where Pikachu is located in his list. Let's help him search for a Pokemon by its name and insert another Pokemon directly after it. Write a function secondPlace() that takes six parameters and inserts a new Pokemon into a list right after another specified pokemon. Once you find the specified Pokemon, use the insertAfter() function from the previous sub-question to add the new Pokemon. The function should return the new number of strings in the array.
Note
The same Pokemon may appear in the list multiple times (Sam has a bad memory). Assume that Sam wants every instance of the Pokemon he is searching for to be followed by the Pokemon he is attempting to insert.
If the array is already full or if the number of strings that are going to be added to the array plus the current number of strings exceeds the total size of the array, the array should remain unchanged.
Assume all inputs are lowercase…
1. Create a UML using the UML Template attached.
2. In this lab, you will be creating a roulette wheel. The pockets are numbered from 0 to 36. The colors of the pockets are as follows:
Pocket 0 is green.
For pockets 1 through 10, the odd-numbered pockets are red and the even-numbered pockets are black.
For pockets 11 through 18, the odd-numbered pockets are black and the even-numbered pockets are red.
For pockets 19 through 28, the odd-numbered pockets are red and the even-numbered pockets are black.
For pockets 29 through 36, the odd-numbered pockets are black and the even-numbered pockets are red.
Create a class named RoulettePocket. The class's constructor should accept a pocket number. The class should have a method named getPocketColor that returns the pocket's color, as a string.
Demonstrate the class in a program that asks the user to enter a pocket number, and displays whether the pocket is green, red, or black. The program should display an error message if the user…
Chapter 15 Solutions
Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)
Ch. 15.2 - Prob. 15.2.1CPCh. 15.2 - Prob. 15.2.2CPCh. 15.3 - Why must a handler be an instance of an...Ch. 15.3 - Explain how to register a handler object and how...Ch. 15.3 - Prob. 15.3.3CPCh. 15.3 - What is the registration method for a button to...Ch. 15.4 - Can an inner class be used in a class other than...Ch. 15.4 - Can the modifiers public, protected, private, and...Ch. 15.5 - Prob. 15.5.1CPCh. 15.5 - What is wrong in the following code?
Ch. 15.6 - Prob. 15.6.1CPCh. 15.6 - What is a functional interface? Why is a...Ch. 15.6 - Prob. 15.6.3CPCh. 15.8 - Prob. 15.8.1CPCh. 15.8 - Prob. 15.8.2CPCh. 15.9 - Prob. 15.9.1CPCh. 15.9 - Prob. 15.9.2CPCh. 15.9 - Prob. 15.9.3CPCh. 15.9 - If the following code is inserted in line 57 in...Ch. 15.10 - Prob. 15.10.1CPCh. 15.11 - Prob. 15.11.1CPCh. 15.11 - Prob. 15.11.2CPCh. 15.11 - Prob. 15.11.3CPCh. 15.11 - Prob. 15.11.4CPCh. 15.12 - How does the program make the ball appear to be...Ch. 15.12 - How does the code in Listing 15.17, BallPane.java,...Ch. 15.12 - What does the program do when the mouse is pressed...Ch. 15.12 - If line 32 in Listing 15.18, BounceBall.java, is...Ch. 15.12 - Prob. 15.12.5CPCh. 15.13 - Prob. 15.13.1CPCh. 15.13 - What would happen if map is replaced by scene in...Ch. 15.13 - Prob. 15.13.3CPCh. 15 - Prob. 15.1PECh. 15 - (Rotate a rectangle) Write a program that rotates...Ch. 15 - (Move the ball) Write a program that moves the...Ch. 15 - (Create a simple calculator) Write a program to...Ch. 15 - (Create an investment-value calculator) Write a...Ch. 15 - (Alternate two messages) Write a program to...Ch. 15 - (Change color using a mouse) Write a program that...Ch. 15 - (Display the mouse position) Write two programs,...Ch. 15 - (Draw lines using the arrow keys) Write a program...Ch. 15 - (Enter and display a string) Write a program that...Ch. 15 - (Move a circle using keys) Write a program that...Ch. 15 - Prob. 15.12PECh. 15 - (Geometry: inside a rectangle?) Write a program...Ch. 15 - Prob. 15.14PECh. 15 - Prob. 15.15PECh. 15 - (Two movable vertices and their distances) Write a...Ch. 15 - (Geometry: find the bounding rectangle) Write a...Ch. 15 - Prob. 15.18PECh. 15 - (Game: eyehand coordination) Write a program that...Ch. 15 - Prob. 15.20PECh. 15 - (Drag points) Draw a circle with three random...Ch. 15 - (Auto resize cylinder) Rewrite Programming...Ch. 15 - Prob. 15.23PECh. 15 - Prob. 15.24PECh. 15 - Prob. 15.25PECh. 15 - Prob. 15.26PECh. 15 - Prob. 15.27PECh. 15 - (Display a running fan) Write a program that...Ch. 15 - (Racing car) Write a program that simulates car...Ch. 15 - Prob. 15.30PECh. 15 - Prob. 15.31PECh. 15 - (Control a clock) Modify Listing 14.21,...Ch. 15 - (Game: bean-machine animation) Write a program...Ch. 15 - Prob. 15.34PECh. 15 - Prob. 15.35PECh. 15 - Prob. 15.36PE
Knowledge Booster
Similar questions
- Discuss the relationship between parameterList and argumentList. If the first parameter has the integer data type and the second parameter has the Double data type, what data types should the first and second arguments have?arrow_forwardcan you do part b?arrow_forwardAssignment 4 In this assignment, you will implement your own interpreter pattern to check a given sentence complies with the sentence requirements given below. Your implementation make sure to do necessary corrections on the sentence. Sentence Requirements: • Every sentence starts with a capital letter. • No sentence can start with a number. • Every sentence ends with a period “.”. • No consecutive words can be same. An exemplary sentence and its corrected version: “ 1 this is is a a sample sentence” Corrected sentence: “This is a sample sentence.” Deliverable: Your Java source code with appropriate design and classes/interface(s).arrow_forward
- 2. Write about reader process in mutual exclusion with help of an example program.arrow_forwardplease in c++ im really struggling and would appreciate the help ill give like, down below i will leave the ADT LinkedSorterLists.h and .cpp c Question: Write an implementation using the ADT LinkedSorterList (textbook code) defining a list of runner objects. Create a Runner class with two attributes one is the time (hh:mm:ss) of the Time datatype and the other is the runner's name. The Time Class has three integer attributes and stores the time in military time format (Ex. 13:45:34). Your program determines the places of the runners. 16. Running the Race Write a program that asks for the names of three runners and the time it took each of them to finish a race. The program should display who came in first, second, and third place. Input Validation: Only accept positive numbers for the times. (Gaddis T. 2018)arrow_forwardGraph data structure. Answer in C++ asap.arrow_forward
- Carefully read the following questions and answer them. Note in particular the parameter passing method (pass- by-value, pass-by-reference, and pass-by-value-result) and the particular actual parameters being passed.arrow_forwardI was hoping I could get help in describing the mountainarrow_forwardC++ Create a Blackjack (21) game. Your version of the game will imagine only a SINGLE suit of cards, so 13 unique cards, {2,3,4,5,6,7,8,9,10,J,Q,K,A}. Upon starting, you will be given two cards from the set, non-repeating. Your program MUST then tell you the odds of receiving a beneficial card (that would put your value at 21 or less), and the odds of receiving a detrimental card (that would put your value over 21). Recall that the J, Q, and K cards are worth ‘10’ points, the A card can be worth either ‘1’ or ‘11’ points, and the other cards are worth their numerical values. FOR YOUR ASSIGNMENT: Provide two screenshots, one in which the game suggests it’s a good idea to get an extra card and the result, and one in which the game suggests it’s a bad idea to get an extra card, and the result of taking that extra card.arrow_forward
- See what happens if you iterate over additional data structures. Is it reasonable to handle the data structures in this manner?arrow_forwardQ5: Design a PDA for accepting a language (0"1"0 | m, n-1} give the ID form as we explain in the lecture. Apply the string "00011000" on this PDA using ID transitions.arrow_forwardCan someone explain what is happening with this code segment for single linked list in C? I have an understanding of linked lists in java, but I am not understanding how this code is creating a linked list in C because I am a complete beginner at C. Please explain what the code is doing at every part. I have found others posting this same code segment for help but the answers provided are not explanations they are just more code. Please provide an explanation in complete sentencesarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning