Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 15.13, Problem 15.13.1CP
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 29:
The purpose of the line is to set focus to the pane after a primary stage gets displayed:
//request focus on the pane
map...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Assume this method is given within the KWLinkedList class, which answer is be correct
public void Unknown()
{ if (size cur = head;
Node prev = tail;
for(int i=0; i< size/2; i++)
{
tail.prev.data = cur.data;
cur= cur.next;
}
}
Implement in C Programming
9.5.1: LAB: Parsing dates
Complete main() to read dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not following that format is incorrect and should be ignored. Use the substring() function to parse the string and extract the date. The input ends with -1 on a line alone. Output each correct date as: 3-1-1990.
Ex: If the input is:
March 1, 1990 April 2 1995 7/15/20 December 13, 2003 -1
then the output is:
3-1-1990 12-13-2003
Use the provided GetMonthAsInt() function to convert a month string to an integer. If the month string is valid, an integer in the range 1 to 12 inclusive is returned, otherwise 0 is returned. Ex: GetMonthAsInt("February") returns 2 and GetMonthAsInt("7/15/20") returns 0.
#include <stdio.h>
#include <string.h>
int GetMonthAsInt(char *monthString) {
int monthInt;
if (strcmp(monthString, "January") == 0) {
monthInt = 1;
}
else if (strcmp(monthString, "February") == 0) {…
a) You have to write code implementing Tower of Hanoi problem using Recursion. You should call the recursive function with 5 disc and display all the moves to transfer the 5 discs from source peg to destination peg.
b) You have to generate the recursive call tree (show all function calls starting from the initial call to the recursive function)
Chapter 15 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th 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
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
- 2. Write about reader process in mutual exclusion with help of an example program.arrow_forward2.12. For each of the following langu es, draw an FA accepting it. g. (b, bba)*(a) h. (aba, aa)* (ba}*arrow_forwardImplement in C Programming 9.10.1: LAB: Movie show time display Write a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator ('|') in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Hints: Use…arrow_forward
- * AHPA #2: The Classroom Problem * Dr. Anderson is teaching a COP 3515 class that has 9 students in it. * Each student has a seating location, a name (just a single letter), and a current score in the class. * The information looks like this: * 1, B, 79.54, 2, M, 82.13, 3, T, 74.61, 4, J, 91.12, 5, P, 78.83, * 6, E, 97.17, 7, H, 85.65, 8, R, 65.42, 9, X, 70.26 Create a C program that will store the number of students in the class in a constant called numStudents. * Store the student seating locations, names, and current scores into individual variables. * Print out the number of students in the class using numStudents. * Print out the class information on three lines in the following format: *XXX XXX XXX * where "xxx" is "seating location, name, current score in class". * Note that the current score should be printed with just one decimal place. Student Name: */ #include #include #include #include #include int main(void) { return 0;arrow_forward*Data Structures (a) The function g(n) is a/an [?] bound on f(n). A. upper B. tight C. lower (b) The function f(n) is a/an [?] bound on g(n). A. upper B. tight C. lower (c) The function g(n) is a/an [?] bound on h(n). A. upper B. tight C. lower (d) The function j(n) is a/an [?] bound on g(n). A. upper B. tight C. lower (e) The function h(n) is a/an [?] bound on k(n). A. upper B. tight C. lower (f) The function k(n) is a/an [?] bound on f(n). A. upper B. tight C. lowerarrow_forwardLab 8 C++ and Provide all code fully Instructions Test 1: An empty list Test 1 in main.cpp prints an empty list (using the output operator) and calls its size accessor function to verify that the size is 0. Here's what you'll need to implement to get this working: Size() is done for you in the .hpp. Fill in the default constructor definition in the .cpp. This is responsible for setting the first, last, and size member variables to reasonable values for an empty list. Fill in the output operator definition in the .cpp. The tests rely on it printing in a very specific format: it should print all elements with only one space after each element. There should be no newline after the last element. Move the /* in RunListTests() in main.cpp to the beginning of Test 2, and see if you pass Test 1 by obtaining the following output: *** List tests on original list: TEST PASSED: 1aTEST PASSED: 1bALL passed Test 2: Inserting elements at the beginning of the list The next task is to implement…arrow_forward
- in c++, apply non-linear data structures to solve simple problems. Question - Write a Program that create sorted Linked List and then split it in two lists (even, odd) your program should delete node (start, Mid, End), Search value and count total number of nodes. Your program should be menu driven and use functional approach. (Drop coding in words with screenshot of output as well)arrow_forwardin c++, apply non-linear data structures to solve simple problems. Question - imagine having a List L1,delete all the nodes having even numbers into info part from the list L1 and insert into List L2 and all the numbers having odd numbers into list L3. (Drop coding in words with screenshot of output as well)arrow_forward3, A lecturer intends to separate his students into 2 groups based on their INDEX Numbers, those with odd numbers in group A and EVEN numbers in B. Use if-else statement to implement thisarrow_forward
- You need to write a C code to have 5 digits dynamically allocated as a number located inside a structure.First, using the append function and create function, you need to create the linked list and at the end instead of using the print and free functions, as we practiced yesterday, you need to use the temporary pointer and next pointer values to deallocate memory.arrow_forwardPlease code in C++ and code new part of program added to bottom. Using the sample BUBBLESORT program given in class do the following: Print out the original unsorted data Print out the data sorted (ascending) Print out the data sorted (descending) Print out the mean Print out the Maximum and Minimum and the range Print out the median Print out ANY values that occur more than once Print out the STANDARD DEVIATION (not shown) Sample output: Unsorted List: 9 8 1 12 3 5 4 4 3 6 1 3 3 Sorted List: 1 1 3 3 3 3 4 4 5 6 8 9 12 (ascending) Sorted List: 12 9 8 6 5 4 4 3 3 3 3 1 1 (descending) Mean: 5 (approx) Maximum: 12 Minimum: 1 Range: 11 Median: 4 FREQUENCY: 1 occurs 2 times 3 occurs 4 times 4 occurs 2 times After this the user is prompted to enter another number. The program would indicate whether the number is less than, equal to, or greater than both the mean and the median. Lastly, the program would indicate where (in the array)…arrow_forwardPlease use easy logic with proper indentations and comments for understanding!. Coding should be in C++. 2. Write a recursive function that reads words from the standard input stream and displays them in reverse order on the standard output stream. For example, if the input was: here comes the sun, the output would be: sun the comes here. Hint: Read individual words until the end of a sentence is reached. You can determine the end of the sentence any way you like. Some suggestions include (a) checking the last character of a word for a sentence terminator (. ? ! ) (b) Using a keyword such as 'quit' to indicate the end of input. (c) Using the eof method of the cin object. (ctrl Z for windows or ctrl D for others can be used to force an end of file from the keyboard.)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education