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 4SA
Program Plan Intro
TranslateTransition class:
- The “TranslateTransition” class makes a node to move from one point to another.
- The constructors of class define different types of operations.
- The constructors in “TranslateTransition” class includes:
- TranslateTransition():
- It creates a “TranslateTransition” object that is empty.
- The “setDuration” method establishes animation’s duration.
- The “setNode” method specifies node that is to be animated.
- “TranslateTransition(duration)”
- The argument “duration” denotes lasting time duration for animation.
- The “setNode” method specifies node that is to be animated.
- “TranslateTransition(duration, node)”
- The argument “duration” denotes lasting time duration for animation.
- The “node” argument denotes the node to animate.
- TranslateTransition():
setToX:
- The method “setToX” is used to specify X coordinate for translation.
- It takes value of X coordinate as argument.
- It denotes the ending location of the node.
setToY:
- The method “setToY” is used to specify Y coordinate for translation.
- It takes value of Y coordinate as argument.
- It denotes the ending location of the node.
Example:
The example for “TranslateTransition” class with “setToX” and “setToY” methods is given below:
Circle cir = new Circle(0, 100, 30);
TranslateTransition trns = new TranslateTransition(new Duration(5000), cir);
trns.setFromX(0);
trns.setFromY(100);
trns.setToX(200);
trns.setToY(150);
trns.play();
Here, “cir” denotes an object of “Circle” class. The given code generates a circle with given dimensions. The circle is been moved from one position to another using “TranslateTransition” method.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Javascript , Web Development
Opengl Help
Programming Language: c++
I need help setting coordinate boundries for this program so the shape can't leave the Opengl window. The shape needs to stay visiable.
Problem Name: Facebook RecommendationsProblem Description: You can visualize Facebook as a graph where the nodes represent a set of users and the edges between the nodes (as a “friend” connection between you and everyone who you have befriended). Your job is to write a program that automatically computes and suggests a new friend recommendation for a user, given knowledge of the entire network. In other words, for each user, suggest the most probable user to befriend based upon the intersection of your common friends. For example, if Person A is a user on the network, Person A will get a recommendation to add Person B as their friend if Person B has the most friends in common with Person A, but B is currently not friends with Person A. The high-level idea is that for any user, you should A) go through all the other users and calculate the number of friends they have in common. B) Find the user in the social network who they are currently not friends with but have the most friends in…
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
- #include "TerminalPlayer.h" Card TerminalPlayer::playCard(const Card& opponentCard) { // if the opponentCard is a Joker we are going first // if the opponentCard is not a Joker we are going second and opponentCard is what our opponent played // Display the player's hand // prompt them to choose a card // remove that card from the hand and return that cardarrow_forwardDisplaying an enumerator's string value requires what method?arrow_forwarddesign patterns quetion public double calculatePerimeter(Shapes [] shapes) { double p = 0;for (Shape shape : shapes) { if (shape is Rectangle) { Rectangle rectangle = (Rectangle) shape; p += (rectangle.Width+rectangle.Height) * 2; } else { Circle circle = (Circle)shape; p += 2 * circle.Radius * Math.PI; } } return p; } which design principle is violated in the above code? what is the issue/ limitation of this code? rewrite the code to not violate the design principle you answered in part 1?arrow_forward
- C#Language: Create a Windows application using Visual Studio. Create a simple word-guessing game using ArrayList and StringBuilder. Create a short description of the game created and explain How it plays. Must show hints for the player what is the word should be guess.arrow_forward#The game Mancala is one of the oldest games in recorded #history. You can read more about it here: #https://www.thesprucecrafts.com/how-to-play-mancala-409424 # #For this problem, though, you don't need to know how to #play the game. All you need to know is the board layout #and the conditions for winning. # #A Mancala board is made of two rows of 6 cups, with two #bigger cups at the ends. Each cup holds some number of #stones or chips. For our purposes, though, we'll include #the bigger cups at the end of the corresponding rows. # #So, for us, a Mancala board is represented as a #2-dimensional list of integers. Each item in the lists #represents a cup, and the number represents how many #stones are currently in that cup. For example, this #could be one board: # # [[5, 3, 0, 2, 6, 8, 1], # [1, 6, 8, 0, 4, 1, 4]] # #With this board representation, the game is over when #every cup is empty except the top left and the bottom #right. When the game is over, whoever has more stones #in…arrow_forwardProductParser Product #productld:String="?" #quantity:int=0 +parseString ToProduct(line ToParse : String) Product #unitPrice:double=0.0 #totalCost:double=0.0 +Product(String, int, double) +getProductid0:String +toString( ):String +computeTotalCost():void Assignment5 +main(String]):void +printMenu):void Clothing Food -name: String="?" -damageRate: double=0.0 -expirationDate: String="08.20.2015" -size: String -color: String +Food(String, int,double,String,double, String) +toString):String +Clothing(String,int,double,String,String) +toString):Stringarrow_forward
- Programming language: PHP - A simple program that declares a variable name word, that has any word as its value. - The program must count its length and assign it to the variable name wrdlngt, and count how many words have been typed, and assign it to a variable name wrdent. - Declare a variable name wrdmulti to hold the product of wrdlngt and wrdent - Lastly, reverse the value of the variable name word and display it together with wrdmultiarrow_forwardJavascript Programming <script>function getCardType() {var cNum1 = document.getElementById("ccNum1").value;var cardname = "";if (cNum1 != "") {if (cNum1.startsWith("4")) {cardname = "Visa";} else if (cNum1.startsWith("5")) {cardname = "MasterCard";} else if (cNum1.startsWith("6")) {cardname = "Discover";} else if (cNum1.startsWith("3")) {cardname = "American Express";}}document.getElementById("cardType").innerHTML = cardname;}</script></body>arrow_forwardJAVA LANGUAGE Create an ArrayList, Name it YourRegNoandName that can hold Integers, and fill each slot with a different random value from 1-50. Display those values on the screen, and then prompt the user for an integer to search through the ArrayList, and if the item is present, say “FOUND”. It is not necessary to display anything if the value was not found. If the item is in the ArrayList multiple times, it's okay if the program prints the message more than once. ALSO SCREENSHOT THE OUTPUTarrow_forward
- Charge Account ValidationCreate a class with a method that accepts a charge account number as its argument. The method should determine whether the number is valid by comparing it to the following list of valid charge account numbers:5658845 4520125 7895122 8777541 8451277 13028508080152 4562555 5552012 5050552 7825877 12502551005231 6545231 3852085 7576651 7881200 4581002These numbers should be stored in an array. Use a sequential search to locate the number passed as an argument. If the number is in the array, the method should return true, indicating the number is valid. If the number is not in the array, the method should return false, indicating the number is invalid.Write a program that tests the class by asking the user to enter a charge account number. The program should display a message indicating whether the number is valid or invalid.arrow_forwardDesign methods aid code comprehension.arrow_forwardTurtle Hare Race Use two Timer objects to write a Java program to simulate the race between turtle and hare. The hare runs faster than the turtle, but it may sleep once or twice during each race. You should take the following requirements into account: The user is allowed to define whether the hare will not sleep, will sleep once, or will sleep twice during the race, by clicking point(s) along the lane. If the user clicks more than twice, only the first two should be considered. The user is allowed to define the speed of the turtle and of the hare. The two numbers input from the user indicate the numbers of milliseconds for each step of the tortoise and for each step of the hare. The user is also allowed to define the sleep time of the hare in milliseconds. If the hare sleeps twice during a race, it sleeps the same amount of time. For each race, the program should provide the result who has won. In Java Pleasearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT