The smallest storage location in a computer's memory is known as a __________.
a. byte
b. word
c. bit
d. switch
c. bit
You might also like to view...
A serialized object is ________.
a. an object represented by XML that includes the object’s data. b. an object in memory that has been recreated from data in a file c. a standard output stream object used to convert objects in code to data in a file d. None of the above.
A graph with integer weights or costs associated with edges is sometimes called a(n) _________________.
a) acyclic graph b) directed graph c) network d) adjacency matrix e) none of the above
Extend the Painter application to enable a user to change the size and color of the circles drawn (Fig. 21.34). This application will use an ArrayList to keep track of the data for all previously drawn circles (as in the Screen Saver application). Each time the paintComponent method is called, draw all previously drawn circles.
a) Copying the template to your working directory. Copy the C:Examples Tutorial21ExercisesAdvancedPainter directory to your C:SimplyJava direc- tory.
b) Opening the template file. Open the PainterJPanel.java file in your text editor.
c) Coding the mouseDragged event handler. Inside the mouseDragged event handler (lines 30–32), add code to call the painterJPanelMouseDragged method with the argument event. You will declare this method in the next step.
d) Declaring the painterJPanelMouseDragged method. After the paintComponent method, add the method header for painterJPanelMouseDragged. This method should be declared private, return void and take a MouseEvent object as its param- eter. Inside the painterJPanelMouseDragged method, add an if…else statement to test if the right mouse button was pressed. If the right mouse button was pressed,
create a new Circle object and assign it to instance variable newCircle. The Circle
constructor should take the diameter of
Find the error(s) and show how to correct it (them) in each of the following.
a) File payables.txt referred to by ofstream object outPayable has not been opened. outPayable << account << company << amount << endl; b) The following statement should read a record from the file payables.txt. The if-stream object inPayable refers to this file, and istream object inReceivable refers to the file receivables.txt. inReceivable >> account >> company >> amount; c) The file tools.txt should be opened to add data to the file without discarding the current data. ofstream outTools( "tools.txt", ios::out );