5.6
1.
To scale the panel size to the image displayed, use the getPanelWidth() and getPanelHeight() functions
2.
Circle(double x, double y, double r, Color c)
double z = scanner.nextDouble()
void setRadius(double z)
3.
for detecting mouse motion, the method MouseMotionAdapter is used.
for detecting mouse clicking, the method MouseAdapter is used.
6.8
1.
to set up a timer, you must use the methods start and actionPerformed. [...]
Archive for the 'Uncategorized' Category
5.6, 6.8
May 6, 20082.7, 3.7, 4.10
April 24, 20082.7
1.
255, 255, 255
0,0,0
0,0,255
128,128,128.
2.
Frames are used for housing the elements of the GUI, panels show colors, text or images, and layout managers determine how everything in multiple panels and frames are laid out.
3.
A border layout arranges panels in 5 places, top, left, right, bottom, and center.
4.
pane.setLayout( new GridLayout(5, 5));
pane.add(panel1)
pane.add(panel2)
pane.add(panel3)
…
pane.add(panel25)
3.7
1.
drawRect (int 45, int 20, int 100, int [...]
12.1
April 15, 20081.
Recursive definitions are not circular because finding sum(n) is finding the sum of n + whatever comes before n, cycling down to 1.
2.
a recursive method must have a stopping state and a recursive step.
3.
4.
Using recursion allows a user to find large sums or the sum of a large series of numbers.
5.
2 x 5
2 x 4
2 [...]
9.1-9.4
February 14, 20089.1.1
With an array, all of the variables can be processed as a group, instead of individually.
9.1.2
to access an item in an array, type
nameofarray[number_of_item]
9.1.3
Wages of the Week
5.23 = wages[0] – Monday
6.23 = wages[1] – Tuesday
6.83 = wages[2] – Wednesday
5.36 = wages[3] – Thursday
6.21 = wages[4] – Friday
9.2.1
a a[1] = 23
b [...]
8.1-8.8
February 1, 20088.1
1. hypertext consists of nodes and links between them
2. hypermedia adds Guis, images, sound, annimation and appliactions to hypertext.
3. uniform resource locators, web addresses.
8.2
1. Hypertext markup language
2. they tell the computer how to show the text and website
3. <HTML>
<HEAD> <TITLE> YO </TITLE> </HEAD>
<BODY> SUP </BODY>
</HTML>
4. an HTML comment is <!– this –>
8.3
1. to [...]
7.2-7.3
January 17, 20087.2.1
The structure of a query-controlled loop for processing repeated sets of inputs allows users to repeat a program without running it twice, simply by using a while command.
7.2.2
a simple line of code could be added to the method to make it repeat, either with a user option, or when an invalid string was entered.
7.3.1
menus can [...]
6.1-6.5
December 7, 20076.1.1
P—|–Q–| ! ((P || Q) && (P && Q))
true|true | false
true|false| true
false|true| true
false|false| true
6.1.2
a. true
b. false
c. true
d. false
6.1.4
Grouping, Method Selector, Unary plus, Unary minus, Not, Multiplication, [...]
Chapter 5 questions
November 5, 20075.1
1. An object is a runtime entity that contains data and responds to messages, while a class is a software package or template that describes the characteristics of similar objects. Classes are used with objects, but objects do not need to be used with classes.
2. When an object’s memory storage is no longer referenced [...]
4.7-4.9
October 11, 20071 a.
i is equal to 1. while i is less than or equal to the variable ‘limit’, add one to i.
if i divided by 2 results in the remainder 0, print the value of i.
b. Generate a new random number. The computer assigns a number between 1 and 10. Declare variable x [...]
Exercises ch 3
September 23, 20073.1
1. The vocabulary of a language is all of the symbols and words recognized by the language. Some examples of items in Java’s vocabulary are +, -, =, and 4.216
2. An example of a syntax rule in Java is that parentheses must always be arranged in the correct order: ( ), never ) (.
3. (x [...]