Msn web hosting - Chapter 20 Java Utilities Package and Bit Manipulation

Chapter 20 Java Utilities Package and Bit Manipulation 1199 e) containsKey f) contains g) clear h) elements i) keys 20.12 Explain how to use the Random class to create pseudorandom numbers with the repeatability required for debugging purposes. 20.13 Use a Hashtable to create a reusable class for choosing one of the 13 predefined colors in class Color. The name of the color should be used as keys and the predefined Color objects should be used as values. Place this class in a package that can be imported into any Java program. Use your new class in an application that allows the user to select a color and draw a shape in that color. 20.14 Modify your solution to Exercise 13.18 the polymorphic painting program to store every shape the user draws in a Vectorof MyShapeobjects. For the purpose of this exercise, create your own Vector subclass called ShapeVector that manipulates only MyShape objects. Provide the following capabilities in your program: a) Allow the user of the program to remove any number of shapes from the Vector by clicking an Undo button. b) Allow the user to select any shape on the screen and move it to a new location. This requires the addition of a new method to the MyShape hierarchy. The method s first line should be public boolean isInside() This method should be overridden for each subclass of MyShape to determine whether the coordinates where the user pressed the mouse button are inside the shape. c) Allow the user to select any shape on the screen and change its color. d) Allow the user to select any shape on the screen that can be filled or unfilled and change its fill state. 20.15 What does it mean when we state that a Propertiesobject is a persistent Hashtable object? Explain the operation of each of the following methods of the Properties class: a) load b) store c) getProperty d) propertyNames e) list 20.16 Why might you want to use objects of class BitSet? Explain the operation of each of the following methods of class BitSet: a) set b) clear c) get d) and e) or f) xor g) size h) equals i) clone j) toString k) hashCode 20.17 Write a program that right shifts an integer variable 4 bits with sign extension and then right shifts the same integer variable 4 bits with zero extension. The program should print the integer in
Note: If you are looking for reliable webhost to maintain and run your java application check Vision java hosting services

Leave a Reply