Page 4 of 4 FirstFirst ... 234
Results 61 to 72 of 72
  1. #61
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

  2. #62
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default

    I believe i will understand it.

  3. #63
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default

    LJ apart from Lectures videos and the book art and science of Java(eric roberts).What materials do you use.Any suggestion for me to improve my java skills.do you practise alot?

    Thank you.

  4. #64
    sonny's Avatar
    sonny is offline Senior Member
    Join Date
    Feb 2010
    Location
    North West England
    Posts
    146
    Rep Power
    0

    Default

    Quote Originally Posted by Learning Java View Post
    My book doesn't mention anything about adding days of the week :confused: Have you a different version of the book? Or was this something you thought would make the program better? Does sound like a good idea though actually! :)
    there is a different version of the book. i think you can find it in a torrent, but i am just using the preliminary Draft version

    i think this exercise was also used in a previous stanford intake as a section exercise.
    CS106A Handouts
    these exercises and handouts are very similar to the ones given in the with the online course zip.
    i think thats where i got my initial version from but it is essentially the same as the book but with days added on the top row.
    An additional requirement was to have the correct number of rows for the days. So that if February started on a Sunday, you would only have 4 rows
    where as if March started on a Saturday you would need 6 rows.

    this is my simplified version without the days of the week added.
    the OP would do well to compare both methods and note that there is seldom one singular solution


    Java Code:
    public class calendar extends GraphicsProgram {
    	private static final int DAYS_IN_WEEK = 7;
    	private static final int DAYS_IN_MONTH = 31;
    	private static final int DAY_WIDTH = 80;
    	private static final int DAY_HEIGHT = 60;
    	/* (Sunday = 0, Monday = 1, Tuesday = 2, and so on)*/
    	private static final int DAY_MONTH_STARTS = 5;
    
    	public void run() {
    		int rows = (DAYS_IN_MONTH + DAY_MONTH_STARTS) / DAYS_IN_WEEK;
    		if ((DAY_MONTH_STARTS + DAYS_IN_MONTH) % DAYS_IN_WEEK != 0){
    			rows++;
    		}
    
    		for (int i = 0; i < rows; i++) {
    			int y = i * DAY_HEIGHT;
    
    			for (int j = 0; j < DAYS_IN_WEEK; j++) {
    				int x = j * DAY_WIDTH;
    
    				add(new GRect(x, y, DAY_WIDTH, DAY_HEIGHT));
    
    				int date = (((DAYS_IN_WEEK * i) + j) - DAY_MONTH_STARTS) + 1;
    
    				if (date > 0 && date <= DAYS_IN_MONTH) {
    					add(new GLabel("" + date + ".", x + 25, y + 35));
    				}
    				
    			}
    		}
    	}
    
    }

    Quote Originally Posted by ccie007 View Post
    LJ apart from Lectures videos and the book art and science of Java(eric roberts).What materials do you use.Any suggestion for me to improve my java skills.do you practise alot?

    Thank you.
    here is a good tutorial that you should consider doing when you get a convienient place in the course.
    if you just finished a chapter why not look at it now.
    Eclipse and Java for Total Beginners

    it more about how to use eclipse than it is about java.
    you can download the videos and watch and type along with the example.
    you will learn a lot about the functionality of eclipse and it will save you a good deal of typing. its 16 15-minute videos.

    You will find that as you progress through 106a you will have to go and find out all sorts of stuff yourself

    the sun java tutorials are a good source of reference learning material
    The Java™ Tutorials

    also the API will prove invaluable as a reference to the many Java classes when you get a little further.
    Overview (Java 2 Platform SE v1.4.2)

    similar documantation for the acm libraries which are used in 106a can be found here

    Generated Documentation (Untitled)
    Last edited by sonny; 05-24-2010 at 03:32 PM.
    :p I still have my "L" plates on...... directions and explanations are far more help than blaring your Horn! :p Watching:CS106a on YouTube \Reading The Art & Science of Java by Eric S Roberts

  5. #65
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default

    Thank you Sonny I will go through them.Much obliged mate.

  6. #66
    Learning Java is offline Senior Member
    Join Date
    May 2010
    Location
    London
    Posts
    106
    Rep Power
    0

    Default

    Quote Originally Posted by ccie007 View Post
    LJ apart from Lectures videos and the book art and science of Java(eric roberts).What materials do you use.Any suggestion for me to improve my java skills.do you practise alot?

    Thank you.
    Nothing else really, I've started going through the Mark Dexter videos though. I have had a lot of help from people on this forum.

    I don't practice enough to be honest.

  7. #67
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default

    Cool.I am going through those videos (Mark) too;)

  8. #68
    Learning Java is offline Senior Member
    Join Date
    May 2010
    Location
    London
    Posts
    106
    Rep Power
    0

    Default

    I wonder whether now is a good time for you to be going through those Mark Dexter videos.

    Are you understanding them?

  9. #69
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default

    Well...is it quite early to go through those at the moment.

  10. #70
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default

    i believe i will understand them if i try.

  11. #71
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: Java Checkerboad question CS106A Stanford univerity

    Do not resurrect old threads.

    What parameters does the GRect constructor take?

  12. #72
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default Re: Java Checkerboad question CS106A Stanford univerity

    Sorry Junky. I moved the post to its own thread.


    Thread closed.
    If you don't understand my response, don't ignore it, ask a question.

Page 4 of 4 FirstFirst ... 234

Similar Threads

  1. CS106A Stanford University
    By Learning Java in forum New To Java
    Replies: 116
    Last Post: 07-09-2011, 04:43 PM
  2. Need help with java question
    By ccie007 in forum New To Java
    Replies: 23
    Last Post: 05-18-2010, 06:32 PM
  3. Java question
    By TGH in forum New To Java
    Replies: 12
    Last Post: 11-27-2009, 02:05 PM
  4. question about java rmi
    By hakimade in forum Advanced Java
    Replies: 1
    Last Post: 07-01-2009, 07:15 AM
  5. Java Question
    By Jay-1.1 in forum New To Java
    Replies: 11
    Last Post: 05-01-2008, 04:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •