Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
4th Edition
ISBN: 9780134787961
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 14, Problem 8SA
Program Plan Intro
ScaleTransition class:
- The “ScaleTransition” class makes a node larger or smaller over time.
- The constructors of class define different types of operations.
- The constructors in “ScaleTransition” class includes:
- ScaleTransition():
- It creates a “ScaleTransition” object that is empty.
- The “setDuration” method establishes animation’s duration.
- The “setNode” method specifies node that is to be animated.
- “ScaleTransition(duration)”
- The argument “duration” denotes lasting time duration for animation.
- The “setNode” method specifies node that is to be animated.
- “ScaleTransition(duration, node)”
- The argument “duration” denotes lasting time duration for animation.
- The “node” argument denotes the node to animate.
- ScaleTransition():
setFromX:
- The method “setFromX” is used to specify scale factor along X axis.
- It takes value of X coordinate as argument.
- It denotes the starting scale factor of the node.
setFromY:
- The method “setFromY” is used to specify scale factor along Y axis.
- It takes value of Y coordinate as argument.
- It denotes the starting scale factor of the node.
Example:
The example for “ScaleTransition” class and methods “setFromX” and “setFromY” is given below:
Circle cir = new Circle(0, 40, 20);
ScaleTransition trns = new ScaleTransition(new Duration(5000), cir)
trns.setFromX(1.0);
trns.setFromY(1.0);
trns.setToX(3.0);
Here, “cir” denotes an object of “Circle” class. The given code generates a circle with particular dimensions. The animation’s duration is 5 seconds. The circle is been displayed with scale factor of 1 initially and it increases to a scale factor of 3.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
public class LineDisplay extends Application
public void start (Stage primarystage)
{
Group root = new Group ();
Scene scene
= new Scene (root, 400, 400, Color.WHITE);
horizontalLines (10, 10, 100, 10, 10, 8, root);
primarystage.setTitle ("Line Display");
primarystage.setScene (scene);
primarystage.show ();
public void horizontallines (int x0, int yo, int init_size,
int increment, int gap, int count, Group group)
{
//
}
}
Design method
public void horizontallines (int x0, int yo, int init_size,
int increment, int gap, int count, Group group)
where
initial point
x0, yo
init_size - sizeo of first line
increment
an amount to add to the size of next line
distance among the lines
number of lines
gap
count
group - group to add the lines
Possible output:
Line .
Computer Science
Write the client code to show how you make use of the LegacyCircle class with your new design.
Java
Given main(), complete the SongNode class to include the printSongInfo() method. Then write the Playlist class' printPlaylist() method to print all songs in the playlist. DO NOT print the dummy head node.
Chapter 14 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Ch. 14.1 - Prob. 14.1CPCh. 14.1 - Prob. 14.2CPCh. 14.1 - Prob. 14.3CPCh. 14.1 - Prob. 14.4CPCh. 14.1 - In what package is the Color class?Ch. 14.1 - Prob. 14.6CPCh. 14.1 - Prob. 14.7CPCh. 14.1 - Prob. 14.8CPCh. 14.1 - Prob. 14.9CPCh. 14.1 - Prob. 14.10CP
Ch. 14.1 - Prob. 14.11CPCh. 14.1 - Prob. 14.12CPCh. 14.2 - Prob. 14.13CPCh. 14.2 - Prob. 14.14CPCh. 14.2 - Prob. 14.15CPCh. 14.2 - Prob. 14.16CPCh. 14.2 - Prob. 14.17CPCh. 14.2 - Prob. 14.18CPCh. 14.2 - Prob. 14.19CPCh. 14.2 - Prob. 14.20CPCh. 14.2 - Prob. 14.21CPCh. 14.3 - Prob. 14.22CPCh. 14.3 - Prob. 14.23CPCh. 14.3 - Prob. 14.24CPCh. 14.3 - Prob. 14.25CPCh. 14.3 - Prob. 14.26CPCh. 14.3 - Prob. 14.27CPCh. 14.3 - Prob. 14.28CPCh. 14.3 - Prob. 14.29CPCh. 14.3 - Prob. 14.30CPCh. 14.4 - What two classes do you use to play an audio file?Ch. 14.4 - Refer to your answer to Checkpoint 14.31. In what...Ch. 14.4 - Prob. 14.33CPCh. 14.4 - Prob. 14.34CPCh. 14.5 - What three classes do you use to play a video...Ch. 14.5 - Refer to your answer to Checkpoint 14.35. In what...Ch. 14.5 - Prob. 14.37CPCh. 14.6 - Prob. 14.38CPCh. 14.6 - Prob. 14.39CPCh. 14.6 - What type of event happens when the user presses...Ch. 14.6 - What KeyEvent method can you call to determine...Ch. 14.6 - Refer to your answer for Checkpoint 14.41. What...Ch. 14 - Line, Circle, and Rectangle are subclasses of...Ch. 14 - Prob. 2MCCh. 14 - Prob. 3MCCh. 14 - Prob. 4MCCh. 14 - Prob. 5MCCh. 14 - Prob. 6MCCh. 14 - Prob. 7MCCh. 14 - Prob. 8MCCh. 14 - This interpolator causes an animation to start...Ch. 14 - You use these two classes to play an audio file....Ch. 14 - Prob. 11TFCh. 14 - Prob. 12TFCh. 14 - True or False: If an ellipses X-radius and...Ch. 14 - Prob. 14TFCh. 14 - Prob. 15TFCh. 14 - Write a statement that instantiates the Line...Ch. 14 - Write a statement that instantiates the Circle...Ch. 14 - Prob. 3AWCh. 14 - Write code that does the following: Instantiates...Ch. 14 - Prob. 5AWCh. 14 - Write a statement that instantiates the Text...Ch. 14 - Prob. 7AWCh. 14 - Assume myBox is a Rectangle object. Write the code...Ch. 14 - Write code that creates a Circle, with a radius of...Ch. 14 - Prob. 10AWCh. 14 - Prob. 11AWCh. 14 - Prob. 1SACh. 14 - Prob. 2SACh. 14 - Prob. 3SACh. 14 - Prob. 4SACh. 14 - Prob. 5SACh. 14 - Prob. 6SACh. 14 - What RotateTransition class method do you use to...Ch. 14 - Prob. 8SACh. 14 - Prob. 9SACh. 14 - Prob. 10SACh. 14 - Prob. 11SACh. 14 - Prob. 1PCCh. 14 - Tree Age Counting the growth rings of a tree is a...Ch. 14 - Hollywood Star Make your own star on the Hollywood...Ch. 14 - Prob. 4PCCh. 14 - Solar System Use the Circle class to draw each of...Ch. 14 - Prob. 6PCCh. 14 - Prob. 7PCCh. 14 - Prob. 8PCCh. 14 - Coin Toss Write a program that simulates the...Ch. 14 - Lunar Lander The books online resources...Ch. 14 - Change for a Dollar Game The books online...Ch. 14 - Rock, Paper, Scissors Game Write a program that...
Knowledge Booster
Similar questions
- Pls make the layout of the game! it is gui based! you do not neet to make the code all the way just what ever you can to get started! In java pls thank you!arrow_forwardclass Solution(object): def generateParenthesis(self, n): def backtrack(left, right, combination): if left == 0 and right == 0: result.append(combination) return if left > right: return if left > 0: backtrack(left - 1, right, combination + "(") if right > 0: backtrack(left, right - 1, combination + ")") result = [] backtrack(n, n, "") return result Give the time and space complexity of this algorithm in Big O notationarrow_forwardAVA code OVERVI EW This is a review exercise, so the primary goal of the exercise is to get your mind working and in the correct space.In this activity you will create a imaginary grid of locations that goes from −?≤?≤?, −?≤?≤?, with the coordinate (0,0) being "home". On this grid you will keep track of various animal objects as they move around the grid. Make sure that all animals stay within that grid at all timesincluding when they are created. Zwill be the map size and will control the highest number allowed on themap before wraping around. Using Java, create the following classes and primary program that uses the classes that you developed. INS T RUCT IONS Create the following classes. A N I MA L C LA SS Create an Animal class. Each animal has a name, an x and y integer coordinate. The Animal class should have at minimum the following methodsbelowbut you may want to add more if necessary: Also note, everyanimal will need to have to have “z”passed to it so that it knows how big the…arrow_forward
- public class CustomLinkedList { public static int findMax(IntNode headObj) { /* Type your code here */ } public static void main(String[] args) { IntNode headObj; IntNode currObj; IntNode lastObj; int i; int max; // Create head node headObj = new IntNode(-1); lastObj = headObj; // Add nodes to the list for (i = 0; i < 20; ++i) { currObj = new IntNode(i); lastObj.insertAfter(currObj); lastObj = currObj; } max = findMax(headObj); System.out.println(max); }}arrow_forwardPlease do not give solution in image format thanku Method: addOneMinute() Description: This method adds one minute to the current time. Method Signature: void addOneMinute() Parameters: This method does not take any parameters. Return Value: This method does not return anything. Instructions: Check the value of getMinute(). If it is between 0 and 58 inclusive, add 1 to it and call setMinute() with the new value. If getMinute() is 59, set minutes to 0 by calling setMinute(0), and then call addOneHour() to add one hour to the time. Note: You may change things around in your program, but for now please make this method work with the existing method signatures. ________________________________________________________________________________________________--- /*** Adds one minute*/void addOneMinute() {/**assume you have working getMinute(), setMinute(m), and addOneHour()* Feel free to change these in your program, but for now please get things to work with* these function signatures.* if…arrow_forwardRequirements:Java ProgrammingMethods in Classarrow_forward
- using namespace std; class SinglyLinkedListNode { // INSERT YOUR CODE HERE }; class SinglyLinkedList { public: SinglyLinkedListNode *head; SinglyLinkedListNode *tail; SinglyLinkedList() { this->head = nullptr; this->tail = nullptr; } voidinsert_node(intnode_data) { // INSERT YOUR CODE HERE } }; void free_singly_linked_list(SinglyLinkedListNode* node) { // INSERT YOUR CODE HERE } // Complete the has_cycle function below. /* * For your reference: * * SinglyLinkedListNode { * int data; * SinglyLinkedListNode* next; * }; * */ bool has_cycle(SinglyLinkedListNode* head) { SinglyLinkedListNode* temp = head; bool isCycle = false; while (temp != nullptr) { // INSERT YOUR CODE HERE } } int main() { // INSERT YOUR CODE HERE TO TEST YOUR CODE return0; }arrow_forwardusing namespace std; class SinglyLinkedListNode { // INSERT YOUR CODE HERE }; class SinglyLinkedList { public: SinglyLinkedListNode *head; SinglyLinkedListNode *tail; SinglyLinkedList() { this->head = nullptr; this->tail = nullptr; } voidinsert_node(intnode_data) { // INSERT YOUR CODE HERE } }; void free_singly_linked_list(SinglyLinkedListNode* node) { // INSERT YOUR CODE HERE } // Complete the has_cycle function below. /* * For your reference: * * SinglyLinkedListNode { * int data; * SinglyLinkedListNode* next; * }; * */ bool has_cycle(SinglyLinkedListNode* head) { SinglyLinkedListNode* temp = head; bool isCycle = false; while (temp != nullptr) { // INSERT YOUR CODE HERE } } int main() { // INSERT YOUR CODE HERE TO TEST YOUR CODE return0; }arrow_forwardAura Assignment: In this assignment we have to crate the similar design using the Lightning web component. Hello New Card Body (custom component) Card Footer Hint: You can use lightning card for it.arrow_forward
- A Node class is defined below. In the main() method , head is declared as Node type, and it refers to null. You need to complete the code to do the followings: create a Node object with your defined variable name set node object's data to 5 set the node object's data to null connect head with the new created node object public class Node App { class Node { public Object data; public Node next; } public static void main() { // declare a node type variable Node head = null; System.out.println("Head of the list: "+ head); // declare a node type and set members (See above) // put your code below // make connection b/w head and new node object // put your code below } }arrow_forwardTree resides in a package called garden. Code a package statement.arrow_forwardJavaProblem 2-1 Random Number ProblemBuild an application where each time a button is clicked, a random number from 1 to 100 is displayed in a textField.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