We hope the following list of questions and answers is helpful.
However, if your question isn't answered below,
we want to be sure that you get an answer!
Check our help page for
for times when help
is available and information about other sources of on-line help.
- How do I make my program into an applet?
See the Programming Contest Information
- How do you use for loops in Java?
- See Phil
Kirschner's page on this
- How do you rotate the dX and dY values?
The newX and newY coordinates can be obtained from oldX and oldY by
the following linear transformation
newX = a * oldX + b * oldY
newY = c * oldX + d * oldY
Based on what we want:
(1,0) -> (0, -1) -> (-1, 0) -> (0,1) -> (1,0)
a = 0
b = 1
c = -1
d = 0
- How is the listener model supposed to work here?
- The idea is that a
Side can have at
most one listener, which for
our purposes is restricted to being a
TetrisBlock listens to its inducing Side.
Side moves, it needs to notify its listening
that it has moved. Based on the (probably new) location
TetrisBlock redraws its
Sides. Each of that
may itself have a listener, which causes those blocks to move, and so
More specifically, set up your code so that a
TetrisBlock registers itself
with its inducing
Side as a listener. Have a
Side notify its listener
by calling its
- Why do my tetris pieces look weird when I rotate them? Sometimes they
blow up or shrink.
- The rotation code equations that you solved use x and y,
which are the original starting point of the inducing vector. The code
only applies to the inducing vector when it is where it started.
You have some choices here:
- Keep track of the current displacement of the inducing vector from
its original starting point. When it comes time to rotate:
- Displace the vector back to its starting point.
- Apply the rotation
- Displace the vector back to where it should be.
- Use a method for rotation that does not depend on the inducing
vector's starting point. This was discussed in class. The basic idea is
to rotate an inducing vector by moving itself to be the reverse of its
listening block's side 1.
- Why do the rooms after unioning not take on the proper color?
- Rooms take on the color of the set into which they are added at the
moment the rooms are actually added. So, you need to establish the color
of a set before you add rooms to it.
- Why does Hall's
- When the maze program calls this method, it should try to open up the
hallway. The logic for determining if the hallway (i.e., the rooms connecting
the hallway) can be opened was discussed in class.
The method returns
true if you decide to open the hallway. The
maze program uses the return value only to determine if it should sleep a while
so you can observe what happened.
- Why does my program show all of the dealer's points?
- What is the definition of
Assuming we want definition (2), then you have to modify
- The sum of all the cards' points in a hand?
- The sum of all the shown cards' points?
points() method accordingly.
- Should takeCard() call wantsCard()?
- NO! takeCard() should just take a card, no questions asked, and add
the card to the player's hand. If you call wantCard() from takeCard(),
bad things will happen:
- Null ptr exceptions because the hand is null and unformed
- Extra customer mouse clicks, because the customer is being asked
twice if he or she wants a card!
- How do I use
- Each player in the game needs an instance variable of type
HandViz. When you want to see the player's hand, you need only
update(CardList) on the instance variable, passing
in the list of cards to be visualized. If a particular card is not
shown, then you see only the back of the card.
When the player is done, call
close() on the
instance variable to make the player's hand go away.
- How do I draw a line of a specific color?
- Recall the
testCanvas drew objects of different
colors. Check this out in
Startup.java from Lab 2.
Also, you can take a look at the API for
- How do I make a new file and add it to my project?
- Open the new file and edit it from the File->Open menu. When you
save it, be sure to check the box "Add to Project".
Or, if you already have the file saved, then open the Project->Edit menu.
In their, add the file to the project.
- How do I work on my lab using the attic and cec computers alternatively?
- Visit the Project->Settings panel and then look at Directories.
Erase the CLASSPATH entry and then click OK. Save and Exit.
For the attic, open and visit that panel again. This time, you should
see a line that begins
.;C\blah blah blah
Just after the first semicolon, insert
and then click OK and you should be set.
For CEC, just leave the CLASSPATH at its default setting.
- How do I work on my lab using the attic computers?
- Instead of clicking on
Attic.prj instead. They use the same files but the
environment is set up for the attic. You should be able to switch
back and forth without trouble. In CEC, continue using
- Where do I start on the design?
- Design the Portfolio object -- put in the methods you need
- You may see that you need a Stock object -- design it
- Design the MarketValue object
- How do I find the current price of one share of a stock?
String sname = "IBM";
Quote oneShare = Lab3.getStockQuote(sname);
/* oneShare.getDollars() dollars and oneShare.getEighths() eighths */
- How do I convert from a string that represents a number into the
int for the number?
String snum = "101";
int num = Lab3.stringToInt(snum)
- How do you get MousePad to read the current location of the mouse click?
- Take a look at the method
Position click() in
the CS101 Canvas .
- How do you get the SegmentDisplay to draw the next segment from where
it last left off?
- You need an instance variable to remember the end of the previously
drawn segment. A
DirectionVector could do this nicely.
- I am frustrated because I cannot figure out what to do in the lab.
- Please get help . Come by to see the
instructor or the TAs during their hours. Hang on -- it gets easier as
you get more comfortable with programming.
- I make changes to my SmartCalculator.java file but the changes
don't seem to be reflected in my executing program.
- Make sure that your SmartCalculator.java file lives in the same directory
as the other files for the lab. Otherwise, the "build" won't be able to
compile your file.
- Do I need any computer science background to succeed in CS101?
- No. The only prerequisite for this course is that you be
comfortable with algebra and geometry at the high school level.
No programming background is required. We start from the beginning. However,
the course is demanding and does move rather quickly. If you're looking
for an easy course, this isn't it.
- I have some programming experience. Will I be bored in
- If past semesters are any indication,
you probably won't be bored. Things may seem a bit slow at the beginning, but
this course can be understood at many different levels.
Also, the material should be sufficiently different from what you have seen
to keep you interested. However, if you have significant experience
in object-oriented programming, particularly in Java or C++, you
should discuss your background with the instructor to determine if the
course is appropriate for you.
- Should I take CS100 along with CS101?
CS100 is a 1-unit course that will acquaint you with
the computing resources at Washington University and teach you how
to several computing tools.
If you are not familiar with these tools,
we recommend that you take CS100 along with CS101.
However, it is not required.
- How much time should I expect to spend on CS101?
- CS101 emphasises learning by doing. Most of your time outside of
class will be spent on lab assignments.
You will spend very little
time reading, since everything you need to know will be covered in
lecture or in the lab assignments. Since CS101 is a 4 unit course,
you should expect to spend about 10 hours per week on average
doing the lab assignments. Some weeks will
require more time, some will require less.
- Is there a textbook for CS101?
- Yes. However, the book is a resource that cannot replace
class attendance. Everything you need to know will be covered in class or on
lab assignments. On-line lecture highlights will be provided to assist your
If you own a computer, consider
purchasing your own copy of the Symantec Cafe
- Do I need a CEC account for CS101?
- Yes. CEC (Center for
Engineering Computing) provides educational computing support for
the School of Engineering and Applied Science. You will need a CEC
account in order to participate in your lab sections. If you are an
Engineering student, you should already have an account. Otherwise,
you should read
- Do I need to buy a computer for CS101?
- No. You do not need to own a computer to take this course.
The Center for Engineering Computing (CEC)
has a PC Lab in Sever 201 that is generally open 24 hours a day, 7 days a week for your use. Should there be a temporary change to CEC lab hours, you will see the updated information in CEC's Message of the Day.
- I own a PC or a Macintosh. How do I set it up to
work on the CS101 assignments?
- Read Setting Up Your Computer for CS101.
- How can I go back to a previous CS101 web page?
- The CS101 pages use frames, so the back arrow at the top of
your browser may take you out of the CS101 pages completely.
To go to a previous or following frame, hold down the right mouse button
over the frame and select the appropriate option from the
- I'm having trouble with my personal computer.
What should I do?
- CEC's FAQ
page on the three systems may have the answer you need. CEC also has
consultants to answer general questions about computer use. However,
please see the CS101 teaching assistants for any questions that
specifically relate to the course.
Questions About Lab Assignments:
- How do I use the PC's in CEC to do my CS101 assignments?
- Read Using CEC in CS101
- How do I open the transcript file for printing?
- When you select the "open" option in the File menu in Cafe,
you may only see the java files. At the bottom left,
where it says "List Files of Type", click and hold the mouse button
on the arrow and drag down to the line that says "all files."
When you release the mouse button, all the files in the folder
will be shown. Scroll down to the one that says "transcript.txt"
and select it for opening. A new window containing the
transcript file will be created, and you can print it by selecting
the "Print" option from its file menu.
- My photo isn't showing up on my home page. What should I do?
If you've had your photo taken by the CEC consultants and it's not
on your homepage, wait about a half hour to give them time to download
it. After that, check the following:
- Make sure that the image reference in your home page file is
your login name followed by .JPG (cytron.JPG
or tmpfl001.JPG for example).
- If it's still not there, go
to http://classes.cec.wustl.edu/~cs101/spring99photos and look for the file with your
login name. Click on the link and make sure it's your picture. Then
go back and check that the information in your .html file matches the name
of the file you were looking at.
If your login name isn't in the list of photos,
the CEC consultants may not have downloaded
the file yet, so you should check with them.
If your name is there, but you don't have permission to see the file,
remind the CEC consultants to set the permissions so the file is readable
by all. If all else fails, ask a TA for help!
- Where are the CS101 bins for turning in assignments?
- On leaving Sever 201, turn right. Continue down the
hallway until it dead-ends into another hallway. This is
4th floor Lopata. Turn right and go almost to the end of the hallway.
There are a bunch of slotted bins along the wall.
Use the one for CS101 --- for your particular lab section.
Last modified 17:43:29 CDT 22 April 1999
by Ron K. Cytron