Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 16, Problem 16.7PE
Program Plan Intro

Program Plan:

  • Include the required import statement.
  • Define the main class.
    • Declare the necessary variables.
    • Allocate memory for two circles and label.
    • Using start initialize the required.
      • Create border panes, text fields and HBox.
      • Set everything into the panel.
      • Set the circle according to the user inputs.
      • Set the color and stroke of the circle.
      • Add action events to the button for typing hour, minute and second.
      • Create a scene and place the pane in the stage.
      • Set the title.
      • Place the scene in the stage.
      • Display the stage.
    • Define the main method using public static main.
      • Initialize the call.
  • Create a class “ClockPane” that extends Pane.
    • Declare required parameters for the clock.
    • Use accessors and mutators methods to get and set the visibility.
    • Define the constructor with no parameters.
      • Get the current time.
    • Define the constructor with three parameters.
      • Set the hour, minute and second.
      • Call the function “paintClock ()”.
    • Use accessors and mutators methods to get and set the hour, minute and seconds.
    • Set the current hour, minute and seconds inside the function “setCurrentTime ()”.
      • Finally call the function “paintClock ()”.
    • Give function definition for “paintClock ()”.
      • Initialize the clock parameters.
      • Create a circle using “new Circle ()”.
      • Set the color and stroke color for the circle.
      • Create four texts to display the time on the clock using “new Text ()”.
      • Set the length to draw second’s hand.
      • Draw the second hand by creating a line using “new Line ()”.
      • Set the stroke color.
      • Set the length to draw minute’s hand.
      • Draw the minute hand by creating a line using “new Line ()”.
      • Set the stroke color.
      • Set the length to draw hour’s hand.
      • Draw the hour hand by creating a line using “new Line ()”.
      • Set the stroke color.
      • Now, clear the pane using “clear ()” method.
      • Add the circle and four texts to the pane.
      • Check if the visibility of second hand is true.
        • Add the second’s hand to the pane.
      • Check if the visibility of minute hand is true.
        • Add the minute’s hand to the pane.
      • Check if the visibility of hour hand is true.
        • Add the hour’s hand to the pane.
    • Give function definition for “setWidth ()” to set width.
      • Set the width of the pane.
      • Call the function “paintClock ()”.
    • Give function definition for “setHeight ()” to set height.
      • Set the height of the pane.
  • Call the function “paintClock ()”.

Blurred answer
Students have asked these similar questions
(Slope of a line) Write a program that prompts the user to enter the coordinates of two points (x1, y1) and (x2, y2), and displays the slope of the line that connects the two points. The formula of the slope is (y2 - y1)/(x2 - x1).
(Display three different messages) Write a program that displays Welcome toPython, Welcome to Computer Science, and Programming is fun.
(Current time) Listing 2.9, ShowCurrentTime.cpp, gives a program that displays the current time in GMT. Revise the program so that it prompts the user to enter the time zone offset to GMT and displays the time in the specified time zone.

Chapter 16 Solutions

Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)

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
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Literals in Java Programming; Author: Sudhakar Atchala;https://www.youtube.com/watch?v=PuEU4S4B7JQ;License: Standard YouTube License, CC-BY
Type of literals in Python | Python Tutorial -6; Author: Lovejot Bhardwaj;https://www.youtube.com/watch?v=bwer3E9hj8Q;License: Standard Youtube License