http://www.barnesandnoble.com/w/an-introduction-to-visual-basic-50-gary-b-shelly/1002550540?ean=9780789527776
Stanton Stuff
Monday, February 11, 2013
Thursday, February 7, 2013
VP project 1
VB PP 1.48-1.50 1-4
Matthew Walker
3A 2/7/13
A.
1. T
2. F
3. F
4. T
5. T
6.
7.
8.
9.
10.
B.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
C.
1. tool
box
2.
form
3.
4.
5.
6.
D.
1.
label
2.
textbox
3.
command button
4. V
scroll bar
5.
Save project
6.
cut
7.
copy
8.
paste
9.
undo
10.
redo
11.
start
12.
end
Wednesday, February 6, 2013
Wednesday, January 30, 2013
Lesson 21 Excercise
Lesson 21 Exercise
Matthew Walker
Balcar 3A 1/30/13
- The classes that convert primitives to objects are called Wrapper classes.
- Name the four primitive data types with which wrapper classes primarily deal.
Integer, Double, Boolean,Character
3.
Write code that will convert double
dx into a wrapper class object. Call the
object dd.
4.
Write code that will produce a Boolean
type wrapper object called bj (“wrap”
a true
inside
it).
boolean bj = bObj.booleanValue( 5<7);
5.
Write code that will convert the integer ip
into an Integer wrapper
class object. Call the
object
ozzie.
6.
Assume you have the object Character
cw. Write code to convert this to a
primitive
character.
7.
Assume you have Double objects d1 and d2. Show how you would multiply the values
stored
in these objects and then store the answer in primitive double dd.
8.
Assume you have Integer objects i1 and i2. Show how you would add the values stored
in
these objects and then store the answer in a third Integer object
called i3.
9.
Write code that will extract the boolean
wrapped in the Boolean wnOh and
test it with an
if statement.
if
( )
10.
Convert the object jj (of type Double) into a primitive float
called ff.
11.
Convert the object pk (of type Double) into a primitive int
called gurg.
What is the
danger
of doing this?
12. What is
the primary purpose of wrapper classes?
Lesson 20 Excercise
Lesson
20 Exercise
Matthew
Walker
Balcar
3A 1/30/13
1.
At any time after several TvShow objects have been instantiated, how would you find out
how
many shows were instantiated? (Don’t use an object to do this.)
2.
Would the code inside the numberOfShows
method still be correct if numberOfShows
were
non-static? If not, why?
3.
Suppose the code inside the numberOfShows
method is replaced with the following
line:
return
y;
Is
this legal? If not, why?
4.
Write code that will print the data member actor2. Do this without instantiating any
objects.
5.
Is the following code legal? If not, why?
TvShow.setActor1(“Jimmy
Stewart”);
6.
Create an instance of TvShow called chrs (pass in the String
“Cheers”) and use it to
access
and print the class variable numShows.
7.
Give the output of the following:
System.out.println(TvShow.x);
TvShow
chrs = new TvShow(“Cheers”);
System.out.println(TvShow.x);
System.out.println(chrs.x);
TvShow
hc = new TvShow(“History Channel”);
hc.x
= 160;
System.out.println(TvShow.x);
System.out.println(hc.x);
8.
Is the following a legal declaration of a class variable? If not, why?
static
public char ch = ‘K’;
9.
Write code that will cause the variable zxb
to be a static state
variable. The variable zxb is
a
double.
10.
Write code that will cause sn to be a constant static
class member. The constant sn should
be
initialized as an empty String.
11.
What is the significance of the word Math
when we use Math.pow(3.2, 4.001)?
Math is the
class variable
12.
Class variables are also called Static
State variables.
13.
Assuming that the appropriate static
import has been done, rewrite the
following code
without
using the class name of the static methods.
double
xop = Math.pow(Math.sqrt(x - zv), 3.1);
14. What
are the two primary reasons for using the key-word, static?
1.
you can call a method without creating an object
2. they are shared by all objects
Subscribe to:
Comments (Atom)