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 .
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.
What happens when a programmer attempts to access a node's data fields when the node variable refers to None? How do you guard against it?
*PYTHON
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
- 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_forwardRoad Trip Programming challenge description: You've decided to make a road trip across the country in a straight line. You have chosen the direction you'd like to travel and made a list of cities in that direction that have gas stations to stop at and fill up your tank. To make sure that this route is viable, you need to know the distances between the adjacent cities in order to be able to travel this distance on a single tank of gasoline, (No one likes running out of gas.) but you only know distances to each city from your starting point. Input: Your program should read lines from standard input. Each line contains the list of cities and distances to them, comma delimited, from the starting point of your trip. You start your trip at point 0. The cities with their distances are separated by semicolon. Output: Print out the distance from the starting point to the nearest city, and the distances between two nearest cities separated by comma, in order they appear on the route. Test 1…arrow_forwardclearBudgetForm(ComboBox<String> categoryComboBox, TextField budgetAmountField) { categoryComboBox.getSelectionModel().clearSelection(); budgetAmountField.clear(); } // Sample Expense class private class Expense { // ... (your existing Expense class) } // Sample Budget class private class Budget { private String category; private double budgetAmount; public Budget(String category, double budgetAmount) { this.category = category; this.budgetAmount = budgetAmount; } // Getters and setters } } Please provide the full code with the changes and provide output. Please and thank youarrow_forward
- Password Cracking with Genetic Algorithms You can use a 19 gene chromosome construct. You do not know the password, but as the correspondence value, you can write a method that compares the characters one by one and returns how many characters the given chromosome differs from the password.arrow_forwardA 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_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
- Downvote gurantee for wrong reason 1._- DO NOT COPY FROM OTHER WEBSITES Correct answer will be Upvoted else downvoted. Thank you!!!.arrow_forwardDouble any element's value that is less than controlValue. Ex: If controlValue = 10, then dataPoints = {2, 12, 9, 20} becomes {4, 12, 18, 20}. import java.util.Scanner; public class StudentScores { public static void main (String [] args) { Scanner scnr = new Scanner (System.in); final int NUM_POINTS = 4; int [] dataPoints new int [NUM_POINTS]; int controlValue; int i; controlValue = scnr. nextInt (); for (i = 0; i < dataPoints.length; ++i) { = scnr.nextInt (); dataPoints [i] } /* Your solution goes here * / for (i = 0; i < dataPoints.length; ++i) { System.out.print (dataPoints[i] + %3D " ") ; } System.out.println ();arrow_forwardimport java.util.ArrayList; public class Bus { privateStringname; privateintsize; privateintbasePrice; privateArrayList<Trip>approvedTrips; privateintlevel;// 1,2,3 for low,medium, high repectively; privateintid; privatestaticintnextId=0; privateMinistrymny; protectedStringtripTypes; privateintgetNextId(){ returnnextId++; } publicBus(){ approvedTrips=newArrayList<Trip>(); } publicBus(Stringname,intsize,intbasePrice,intlev,Ministrymny){ approvedTrips=newArrayList<Trip>(); this.name=name; this.size=size; this.basePrice=basePrice; this.level=lev; this.id=getNextId(); this.mny=mny; tripTypes="BASICTRANSPORT"; } publicbooleanavailable(Datedate){ booleanretval=true; for(Tript:approvedTrips) if(t.getDate().getDay()==date.getDay()) retval=false; returnretval; } publicintgetBasePrice(){ returnbasePrice; } publicintgetId(){ returnid; } publicStringgetName(){ returnname; } publicdoublegetSize(){ returnsize; } publicStringtoString(){ returnname; }…arrow_forward
- Magic 8 Ball Lab Introduction For this lab, you are going to build a simple magic eight-ball, so you no longer have to make any choices. On that note, if you haven’t, you should watch Interstate 60. All joking aside, you will build a 15 sided magic 8-ball, just for simplicity (an actual one has 20 sides for choices). If you are curious about all the choices, you can read up more on them here. Also, if you need a refresher on if statements, go here. Step 1 - Reading the code First take a look at the provided code. You should change the comments to include your name at the top of the file. Furthermore, you will notice all the functions are ‘stubbed’ out for you. This means we have provided the function signature, and a dummy return value that you will replace completely. We have also provided one function in its entirety, so you can use it as a sample/template to look at. def get_positive_answer(answer): ans = "You may rely on it." if answer == 0: ans = "As I see…arrow_forwardA 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’sdatato 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_forwardclass Node { public: Node() : data(0), prev(nullptr), next(nullptr) {} Node(int theData, Node* prevLink, Node* nextLink) : data(theData), prev(prevLink), next(nextLink) {} int getData() const { return data; } Node* getPrev() const { return prev; } Node* getNext() const { return next; } void setData(int theData) { data = theData; } void setPrev(Node* prevLink) { prev = prevLink; } void setNext(Node* nextLink) { next = nextLink; } ~Node(){} private: int data; Node* prev; Node* next; }; class AnyList { // friend function overloads the insertion operation public: // copy constructor // overloaded assignment operator // other member functions not necessary for your implementation private: Node *first; Node *last; int count; }; please help write copy constructor #include "AnyList.h" #include <iostream> using namespace std; // Definition of copy constructor // Instructions omitted intentionally. // Your codearrow_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