Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
6th Edition
ISBN: 9780134477367
Author: David J. Barnes, Michael Kolling
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 3, Problem 29E

Explanation of Solution

Given: The object of ClockDisplay class and the timeTick method.

To find: The number of times the timeTick method is required to call to reach the time 01:00 and identify other alternatives to make the time reach 01:00.

Solution:

The number of times timeTick method is required to be called is 60 times in order to make its time reach 01:00.

Calling timeTick() method:

Calling getTime() method:

Result of calling getTime() method:

Calling timeTick() method:

Calling timeTick() method:

Calling getTime() method:

A console output window showing timeTick() method is called 60 times:

Blurred answer
Students have asked these similar questions
Open the clock-display project and create a ClockDisplay object by selecting the following constructor: new ClockDisplay() Call its getTime method to find out the initial time the clock has been set to. Can you work out why it starts at that particular time?
when coding a chess game, implement the following method: isInCheck(Side s): Returns true if the king of side s is attacked by any of the opponent’s pieces, i.e., if in the current board state, any of the opponents pieces can move to where the king is. Otherwise, it returns false. Note that this method is only used to warn the player when they are in check. You can use the GUI to test if this is working.         public boolean isInCheck(Side side) {         // TODO write this method         return false;     }         public enum Side {     BLACK, WHITE;       public static Side negate(Side s) {         return s == Side.BLACK ? Side.WHITE : Side.BLACK;     } }
Write down four more color constants that are available in the Color class. Refer to the class’s documentation to find out what they are.

Chapter 3 Solutions

Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)

Ch. 3 - Prob. 11ECh. 3 - Prob. 12ECh. 3 - Which of the following expressions return...Ch. 3 - Write an expression using boolean variables a and...Ch. 3 - Write an expression using boolean variables a and...Ch. 3 - Consider the expression (a && b). Write an...Ch. 3 - Does the getDisplayValue method work correctly in...Ch. 3 - Prob. 18ECh. 3 - In Exercise 2.79 you were asked to investigate...Ch. 3 - Explain the modulo operator. You may need to...Ch. 3 - What is the result of the expression 83?Ch. 3 - Try out the expression in the Code Pad. Try other...Ch. 3 - Prob. 23ECh. 3 - Prob. 24ECh. 3 - Explain in detail how the increment method works. Ch. 3 - Rewrite the increment method without the modulo...Ch. 3 - Open the clock-display project and create a...Ch. 3 - Prob. 28ECh. 3 - Prob. 29ECh. 3 - Prob. 30ECh. 3 - Look at the second constructor in C1ockDisplay's...Ch. 3 - Prob. 32ECh. 3 - Given a variable Printer p1; which currently holds...Ch. 3 - Open the house project from Chapter 1 and review...Ch. 3 - Prob. 35ECh. 3 - Does the Picture class contain any internal method...Ch. 3 - Remove the following two statements from the draw...Ch. 3 - Prob. 38ECh. 3 - Prob. 39ECh. 3 - Assume a class Tree has a field of type Triangle...Ch. 3 - Prob. 41ECh. 3 - Open the mail-system project, which you can find...Ch. 3 - Prob. 43ECh. 3 - Prob. 44ECh. 3 - Open the editor for the MailClient class and set a...Ch. 3 - Step one line forward in the execution of the...Ch. 3 - Prob. 47ECh. 3 - Prob. 48ECh. 3 - Prob. 49ECh. 3 - Set a breakpoint in the first line of the sendMai1...Ch. 3 - Use a combination of code reading, execution of...Ch. 3 - Use the debugger to investigate the clock-display...Ch. 3 - Prob. 53ECh. 3 - Prob. 54ECh. 3 - Prob. 55ECh. 3 - Describe the changes that would be required to the...Ch. 3 - Write the code for the timeTick method in...Ch. 3 - Discuss whether the current design of the...Ch. 3 - Challenge exercise In the current design of...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781305480537
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT