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
Concept explainers
Question
Chapter 16, Problem 16.17PE
Program Plan Intro
Use ScrollBar and Slider
Program Plan:
- Declare the class “Colors” extends “Application”.
- Create object for TextField.
- Create an object for label.
- Create an object for scroll bar.
- Method Definition for “start() ”.
- Create object for “BorderPane”.
- Add colors to grid pane.
- Set “gp” to “p1”.
- Set the scroll pane.
- Add button to “p1”.
- Set the text at the center
- Set the position.
- Set the vertical and horizontal gap.
- Create an object “sc” for scene.
- Set the stage title.
- Place the scene in the stage.
- Using the “show()” to display the stage.
- Activate the colors.
- Method definition for “updateColor()”
- Fixing the red color.
- Fixing the green color.
- Fixing the blue color.
- Fixing the opacity.
- Method definition for main class.
- Call the “launch()”
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Please do it on Visual Studios using Python.
(Use version Python3)
C#
(Guess the Number Game) Write a program that plays “guess the number” as follows: Your program chooses the number to be guessed by selecting an int at random in the range 1–1000. The program then displays the following text in a label:
A TextBox should be used to input the guess. As each guess is input, the background color should change to red or blue. Red indicates that the user is getting “warmer,” blue that the user is getting “colder.” A Label should display either “Too High” or “Too Low,” to help the user zero in on the correct answer. When the user guesses the correct answer, display “Correct!” in a message box, change the Form’s background color to green and disable the TextBox. Recall that a TextBox (like other controls) can be disabled by setting the control’s Enabled property to false. Provide a Button that allows the user to play the game again. When the Button is clicked, generate a new random number, change the background to the default color and enable the TextBox.
(Find the two highest scores)Write a program that prompts the user to enter the number of students and each student’s name and score, and displays the name and score of the student with the highest score and the student with the second-highest score.Sample RunEnter the number of students: 5Enter a student name: SmithEnter a student score: 60Enter a student name: JonesEnter a student score: 96Enter a student name: PetersonEnter a student score: 85Enter a student name: GreenlawEnter a student score: 98Enter a student name: ZhangEnter a student score: 95Top two students:Greenlaw's score is 98.0Jones's score is 96.0
Chapter 16 Solutions
Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)
Ch. 16.2 - Prob. 16.2.1CPCh. 16.2 - Prob. 16.2.2CPCh. 16.2 - Prob. 16.2.3CPCh. 16.2 - Prob. 16.2.4CPCh. 16.3 - How do you create a button with a text and a node?...Ch. 16.3 - Prob. 16.3.2CPCh. 16.3 - Prob. 16.3.3CPCh. 16.4 - What is the output of the following code? public...Ch. 16.4 - Prob. 16.4.2CPCh. 16.4 - Prob. 16.4.3CP
Ch. 16.4 - Prob. 16.4.4CPCh. 16.5 - Prob. 16.5.1CPCh. 16.5 - Can you apply all the methods for Labeled to...Ch. 16.5 - Prob. 16.5.3CPCh. 16.5 - Prob. 16.5.4CPCh. 16.6 - Prob. 16.6.1CPCh. 16.6 - Can you apply all the methods for TextInputControl...Ch. 16.6 - Prob. 16.6.3CPCh. 16.6 - Prob. 16.6.4CPCh. 16.7 - Prob. 16.7.1CPCh. 16.7 - Prob. 16.7.2CPCh. 16.7 - Prob. 16.7.3CPCh. 16.7 - Prob. 16.7.4CPCh. 16.8 - Prob. 16.8.1CPCh. 16.8 - Prob. 16.8.2CPCh. 16.8 - Prob. 16.8.3CPCh. 16.8 - Prob. 16.8.4CPCh. 16.9 - Prob. 16.9.1CPCh. 16.9 - Prob. 16.9.2CPCh. 16.9 - Prob. 16.9.3CPCh. 16.9 - How do you obtain the selected items and selected...Ch. 16.10 - Prob. 16.10.1CPCh. 16.10 - Prob. 16.10.2CPCh. 16.10 - Prob. 16.10.3CPCh. 16.11 - Prob. 16.11.1CPCh. 16.11 - Prob. 16.11.2CPCh. 16.11 - Prob. 16.11.3CPCh. 16.12 - Prob. 16.12.1CPCh. 16.12 - Prob. 16.12.2CPCh. 16.12 - How does the program check whether a player wins?...Ch. 16.13 - Prob. 16.13.1CPCh. 16.13 - Prob. 16.13.2CPCh. 16.13 - Prob. 16.13.3CPCh. 16.14 - Prob. 16.14.1CPCh. 16.14 - Prob. 16.14.2CPCh. 16 - Prob. 16.1PECh. 16 - Prob. 16.2PECh. 16 - (Traffic lights) Write a program that simulates a...Ch. 16 - (Create a miles/kilometers converter) Write a...Ch. 16 - (Convert numbers) Write a program that converts...Ch. 16 - (Demonstrate TextField properties) Write a program...Ch. 16 - Prob. 16.7PECh. 16 - (Geometry: two circles intersect?) Write a program...Ch. 16 - (Geometry: two rectangles intersect?) Write a...Ch. 16 - (Text viewer) Write a program that displays a text...Ch. 16 - (Create a histogram for occurrences of letters)...Ch. 16 - Prob. 16.12PECh. 16 - (Compare loans with various interest rates)...Ch. 16 - (Select a font) Write a program that can...Ch. 16 - (Demonstrate Label properties) Write a program to...Ch. 16 - Prob. 16.16PECh. 16 - Prob. 16.17PECh. 16 - (Simulation a running fan) Rewrite Programming...Ch. 16 - Prob. 16.19PECh. 16 - Prob. 16.20PECh. 16 - (Count-down stopwatch) Write a program that allows...Ch. 16 - (Play, loop, and stop a sound clip) Write a...Ch. 16 - (Racing cars) Write a program that simulates four...Ch. 16 - (Slide show) Programming Exercise 15.30 developed...Ch. 16 - Prob. 16.29PECh. 16 - (Pattern recognition: consecutive four equal...Ch. 16 - (Game: connect four) Programming Exercise 8.20...
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
- (Written in Java or Python) Write a program that allows a user to select 3 points on a graphics panel. Then, draw a triangle using these 3 points. Allow the user to specify a number of random points to be generated inside of the triangle. For each random point that is within the boundaries of the triangle draw a small dot at each of the points that are halfway between the randomly generated point and each vertex of the triangle. Do not draw the randomly generated point. Allow the user to repeat the process without removing the old dots. Allow the user to clear the screen.arrow_forwardim stuck on this onearrow_forward1- Let's start with some mediatione Print the following pattern on to the screen; uses one printf () to print "smile Smile!" on one line, uses a second printf() call to print "Joy" and "Gratitude" on two separate lines, and uses a pair of printf () calls to print "Work" and "Hard" on one line. Finally finish off by displaying "Play Harder" using a last printf() statement. The output should look like this: Smile Smile! // First print statement Joy // Second print statement Gratitude // Still the second print statement Work Hard // Third and fourth print statements Play Harder // Fifth print statement 2- Now we can move on to writing some code that calculates the average of 3 numbers. a) This program takes 3 numbers of type int as input. Use a prompting message to read any 3 integers and store them in appropriate variables. b) Calculate the average of the 3 input variables and store them in the variable that of type double. Note: Make sure that your average value calculations are…arrow_forward
- 1. ( powepoint) create a prtesentation of five slides and summarize any 5 topicts wehave cover so far. Each slide should have a different animation. insert an object on your slides using slide master. 2. Print screean of the all what you have done in microsoft word and paste in on slide 2. 3. create the first slide with a chart and a cartoon facing that chart,then the two should have different animations that the chart should appear first and then a cartoon. 4.Add slide numbers and date. Use facet design, Title and 2 content slide layout. 5. Make the presentationautomaticarrow_forwardPlease use Visual Studios coding in Python. (Use Python 3 Version)arrow_forward#this is a python program #topic: OOP Design the required class from the given code and the outputs. [You are not allowed to change the code below] Hint: Number of the border characters for the top and the bottom = 1 + Number of spaces between the left side border and the first character of the button name + Length of the button name + Number of spaces between the right side border and the last character of the button name + 1 NOTE: Don’t count the space or any character from the button representation to solve this problem. #Write your class code here word = "CANCEL" spaces = 10 border = 'x' b1 = buttons(word, spaces, border) print("=======================================================") b2 = buttons("Notify",3, '!') print("=======================================================") b3 = buttons('SAVE PROGRESS', 5, '$') Output: CANCEL Button Specifications: Button name: CANCEL Number of the border characters for the top and the bottom: 28 Number of spaces…arrow_forward
- Object-Oriented Programming ------------------------------------arrow_forwardQ3. (Dice Rolling) Write a program that simulates the rolling of two dice. The program should use rand to roll the first die and should use rand again to roll the second die. The sum of the two values should then be calculated. [Note: Each die can show an integer value from 1 to 6, so the sum of the two values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 being the least frequent sums.] Figure 7.26 shows the 36 possible combinations of the two dice. Your program should roll the two dice 10,000 times. Use a one-dimensional array to tally the numbers of times each possible sum appears. Print the results in a tabular format. Also, determine if the totals are reasonable (i.e., there are six ways to roll a 7, so approximately one-sixth of all the rolls should be 7). 1 2 3 4 5 1 2 4 6 7 3 4 6 7 3 4 5 7 8 9 4 7 8 9 10 7 8 10 11 7 10 11 12 Row\Col 3.arrow_forwardQ4) - Design a program to replace the text "Applied Sciences" between two label every two second.arrow_forward
- INSTRUCTIONS: Create a python program and use looping statements. Make use of comments to provide explanation with the steps of coding. Provide the source code (text format: for easy copy-paste) and screenshot/s of the running output and source code. 7. Write a program to convert a number to an English equivalent string formed from the reversed digits. For example, 123 represented by "three two one" and 3017 is represented by "seven one zero three".arrow_forward- Please do a simple Python code and correct Flowchart with the correct Loop and shapes. 1. Begin the roulette game by printing “Welcome to the roulette table!”. 2. Prompt the player to enter the bet they would like to make. 3. Check if the bet is valid by comparing it to the list of possible bets. 4. If the bet is not valid, prompt the player to enter another bet. 5. Prompt the player to enter the amount they would like to bet. 6. Check if the amount is valid by checking if it is a digit. 7. If the amount is not valid, prompt the player to enter another amount. 8. Generate a random number between 0 and 36. 9. Use the random number to determine the color of the wheel. 10. Check if the player won by comparing their bet to the outcome. 11. If the player won, calculate the payout and inform the player. 12. If the player lost, inform the player that they lost the amount they bet. - Please do a simple…arrow_forward(Target-Heart-Rate Calculator) While exercising, you can use a heart-rate monitor to see thatyour heart rate stays within a safe range suggested by your trainers and doctors. According to the American Heart Association (AHA) (www.americanheart.org/presenter.jhtml?identifier=4736), theformula for calculating your maximum heart rate in beats per minute is 220 minus your age in years.Your target heart rate is a range that is 50–85% of your maximum heart rate. [Note: These formulas areestimates provided by the AHA. Maximum and target heart rates may vary based on the health, fitness andgender of the individual. Always consult a physician or qualified health care professional before beginning ormodifying an exercise program.] Create a class called HeartRates. The class attributes should include theperson’s first name, last name and date of birth (consisting of separate attributes for the month, dayand year of birth). Your class should have a constructor that receives this data as…arrow_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