CS 101 (Spring 1999)
Frequently Asked Questions (FAQs)

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.

[Midterm Review]
[Applets] [Lab 11] [Lab 10] [Lab 7] [Lab 6] [Lab 4] [Lab 3] [Lab 2] [Lab 1]
[First-Day Questions] [General Questions]
[Lab 0]

Applet Questions:

How do I make my program into an applet?
See the Programming Contest Information

Lab 11 Questions:

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)
we get
  a = 0
  b = 1
  c = -1
  d = 0

Lab 10 Questions:

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. Each TetrisBlock listens to its inducing Side. When a Side moves, it needs to notify its listening TetrisBlock that it has moved. Based on the (probably new) location of the TetrisBlock's inducing Side, the TetrisBlock redraws its Sides. Each of that TetrisBlock's Sides may itself have a listener, which causes those blocks to move, and so on.

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 sideMoved method.

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:


Lab 7 Questions:

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 openedUpHallway return boolean?
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.


Lab 6 Questions:

Why does my program show all of the dealer's points?
What is the definition of points() in CardList?
  1. The sum of all the cards' points in a hand?
  2. The sum of all the shown cards' points?
Assuming we want definition (2), then you have to modify your 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:
How do I use HandViz?
Each player in the game needs an instance variable of type HandViz. When you want to see the player's hand, you need only call 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 HandViz instance variable to make the player's hand go away.


Lab 4 Questions:

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 Line in cs101's canvas package.

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
  P:\cafe151\Java;
and then click OK and you should be set. For CEC, just leave the CLASSPATH at its default setting.

Lab 3 Questions:

How do I work on my lab using the attic computers?
Instead of clicking on Lab3.prj>, open 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 the Lab3.prj.
Where do I start on the design?
  1. Design the Portfolio object -- put in the methods you need
  2. You may see that you need a Stock object -- design it
  3. 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)

Lab 2 Questions:

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.

Lab 1 Questions:

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.


Common First-Day Questions:

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 CS101?
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 studies. If you own a computer, consider purchasing your own copy of the Symantec Cafe programming environment.

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 Getting a CEC Account.

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.


General Questions:

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 popup menu.

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:

Lab 0:

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:
  1. 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).
  2. 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