University of Toronto
Department of Computer Science

CSC 108 - INTRODUCTION TO COMPUTER PROGRAMMING

Assignment 1 page



Assignment 1 advice

January 30
Question: Only one person in the group need to submit the assignment, or both of us have to send it through internet?
Answer:One submission per group is enough.

January 30
Question: Do we only need to write comments only for describing the class and methods? Or we have to wirite comments explaining what we do each line in the mothod body as well? Do we have to express the comments using"/**/"or we can use "//"too?
Answer: Comments for the class and methods should be enough. If you do something obscure within a method an additional comment explaining your logic should be included. Class and method comments should use the /* */ format. Single line comments in the body of a method often use the // format.

January 30
Question: Are we allowed to declare JFrames as instance varialbes in the class other than the DayNameWindow class and the QuarteringWindow class?
Answer: Check the description of the assignment again. In quartering window it says to use instance variables for the additional JFrames. In DayNameWindow you are not creating a new window you are just changing the title of the existing window.

January 29
Question: I have a question about the OverlappingWindow class. In the first method [setOverlap(int dH,int dV)] I have no problem setting the amount of overlap, but then when it comes to the [overlap()] method how do I show it (or create it) without using the dH and dV variables? Or how can I get to those variables?
Answer:The variables are in your instance of OverlappingWindow class. Having set them in the setOverlap method use them in the overlap method.

January 29
Question: The assignment advises us to play around with the Date and Day class before we go on but I have no idea how to use the Day class. Any extra advice?
Answer:Create an instance of each and call the different methods available to see how they work. Try using the return value from one class's methods as an argument for the other class.

January 28
Question: Should we actually create four new JFrames each time the method quarter() is called, or could we just change the size and location of our existing JFrames that we access through instance variables?
Answer: You may simply recycle the same JFrames, with new sizes and locations, each time you call quarter(), quarterVertical(), or quarterHorizontal()

January 28
Question: Since we don't use the Date variable in DayNameWindow (except to set it), why do we need it?
Answer: You may need to use a Date object to generate the integer representing the current day of the week. This is something you need when you create a Day object.

January 28
Question: Should our overlapping window be the same size as the current window?
Answer: Yes.

January 28
Question: Does the method setOverlap() display the overlapping window?
Answer: Not according to the specification: the method overlap() does.

January 23
Question: Can you clarify the methods in the QuarteringWindow?
Answer:The methods of QuarteringWindow create *and display* four new JFrames. Each of the three methods creates and displays the new JFrames in a different pattern.

January 22:
Question: For the DayNameWindow class, it asks me to display the current day on the title of the JFrame. so, let say today is jan.22, wednesday, how should my title looks like? my display now is like this: "22wednesday"
Answer: No it shouldn't look like the above. The class Day has a method today() that returns the day of the week as a String, displayToday() sets the title to "Wednesday". As was suggested in the assignment handout. Before starting the DayNameWindow class spend some time experimenting with both the Date and Day classes.

January 21:
Answer: There is an easier way to include Day.class.
Once you download Day.class for assignment 1, you'll need to let DrJava know where to find it. The simplest way to do this is to store Day.class in the directory or folder where you're working on assignment 1, and then create and compile at least one class in that directory. Once you've done that, Day.class will be known to DrJava, and you'll be able to include statements such as:

Day d;

... in your code.

January 21:
Question: How do I make Day.class known to DrJava?
Answer: To make classes in the current folder available to the drjava interactions pane (and to classes that you write), you need to go under "Edit" in DrJava, then "Preferences", then "Resources". Once there, you add the directory you're working in to the Extra Classpath box, and save this.

January 19:
Question: When I shrink a ResizingWindow why is the minimum width always 112?
Answer: There's a constraint in MicroSoft Windows that limits the size of a JFrame. As it says in the assignment description we will test your submissions with reasonable data.