Lecture 7 | Programming Methodology (Stanford)

Поділитися
Вставка
  • Опубліковано 23 жов 2024

КОМЕНТАРІ • 192

  •  11 років тому +31

    This man is programming rockstar! I love him! If every teacher teach like him the world should be the better place :D

  • @zhang6051
    @zhang6051 10 років тому +48

    I wish I had better understood the what the term "Good education" meant when I was younger. After seeing this professor, now I understand.

  • @KshitijBajracharya
    @KshitijBajracharya 5 років тому +8

    These series of videos have been out there for over 11 years and I never knew they existed. I've been programming professionally for about 5 years now, and even though I know most of the stuff he talks about, I can't stop watching these videos just because of the simplistic way in which he explains things, hoping that I could pick one or two things from him that I haven't learnt yet. Undoubtedly the best lecture series I've ever watched. Thank you so much Professor Sahami or Mehran as he'd like to be referred as.

  • @riturajsingh3874
    @riturajsingh3874 10 років тому +26

    This man is simply awesome! Teaching with so much energy throughout!!
    RESPECT Professor Mehran Sahami !

  • @Tutoelectro1
    @Tutoelectro1 14 років тому +1

    I hope someone read all this comments and tell to Mehran he is the best at what he does!! He makes you want to learn more and more. I wish all teachers where like him.

  • @ignaciocorto
    @ignaciocorto 9 років тому +13

    25:44 I like that analogy about comparing functions-as-objects with a CD Player

  • @nirvana1233
    @nirvana1233 7 років тому +30

    2017, watching 360p lectures. 10/10, would do again

    • @xX123Dorian123Xx
      @xX123Dorian123Xx 6 років тому +6

      It's 480p It's next gen ( ͡° ͜ʖ ͡°)

    • @eterr9000
      @eterr9000 21 день тому

      Hello from 2024, still worth it!

  • @tbga1970
    @tbga1970 12 років тому +2

    Best lecture on video I have ever seen. If they ever tape my classes, I hope to emulate Sahami's energy and engagement.

  • @maxfoster435
    @maxfoster435 10 років тому +6

    Prof. Sahami is the Mr. Rogers of Computer Science.

  • @k3nny111
    @k3nny111 10 років тому +43

    Can anyone imagine Professor Sahami sitting in a room silently working on code for 8 hours straight?

  • @TheD2D21
    @TheD2D21 12 років тому

    Great class! Thank you to the administrators, the faculty, but above all, thank the students at Stanford who make this possible. You're wonderful people for sharing education with the world.

  • @andreeazamfir9713
    @andreeazamfir9713 9 років тому +15

    It's like he never takes a breath.

  • @mallithemadman
    @mallithemadman 14 років тому

    i'm a classroom training is best kinda person... Mehran changed my opinion... I can stick to my chair for more than 2 hours... man he is THE MASTER!!! Long live his lectures.. i spent 27 hours already on his lectures... Bravo Bravo!!!

  • @11th_Moon
    @11th_Moon Рік тому

    Stanford and Mr.Sahami, thanks for bringing it to us. Great teacher, som useful material.

  • @Artilla2012
    @Artilla2012 11 років тому +7

    its getting harder.. loving the tectures...

  • @jaysondelosreyes8224
    @jaysondelosreyes8224 3 роки тому

    Its so easy to absorb what he was teaching its amazing.

  • @azuboof
    @azuboof Рік тому

    Wow! Just decided to watch this for time pass. Insane lecture. Loved it. -from India

  • @JoshHurlebaus
    @JoshHurlebaus 12 років тому +2

    I already thought Mehran was awesome, but then he goes and brings in AiC and becomes the greatest professor of all time.

  • @stefankogut
    @stefankogut 9 років тому +2

    Finally, factorial problem solved without recursion presented into an official course...

  • @Sinusis
    @Sinusis 8 років тому +1

    truly inspirational course.

  • @ashrafhossainsachin8670
    @ashrafhossainsachin8670 3 роки тому +1

    2021, watching Mehran lectures over and over again

  • @susanfoley8360
    @susanfoley8360 9 років тому +1

    I went to Stanford back in the dark ages before desktop computers were invented and it's great how much this reminds me of home.

  • @starbiz666
    @starbiz666 9 років тому +1

    This brings back memories... The good old days

  • @iyadajeeb1986
    @iyadajeeb1986 9 років тому +5

    Well this one escalated quickly ... considerably harder than Lecture 6 ! Need to watch it a couple of more times !

    • @samjain6555
      @samjain6555 8 років тому +2

      +Hiken Ace Keep it up man, I am watching this one my third time.

    • @ajpatako
      @ajpatako 8 років тому +1

      +Hiken Ace Same here, man... same here...

  • @phartatmisassa5035
    @phartatmisassa5035 11 років тому +2

    Day 1
    - Finished watching lectures 1 through 7
    - Got Eclipse, sun-java6-sdk, Karel, and acm.jar set-up
    - Read Chapter 1 of The Art and Science of Java (early-draft, it was free, hopefully legal, I found it just Google'ing the title)
    Day2-3
    -Gonna hurdle through assignment 1 - 7 and read some more.

  • @jaimegarcia9088
    @jaimegarcia9088 10 років тому +5

    Just a small note for those following the book as well: In Chapter 4.3 we're introduced to the ternary operator ?: but the explanation is quite confusing (which surprised me because everything up until that point was perfectly disclosed). If you want to understand the ?: operator in less than one minute please do yourselves a favor and follow this link: stackoverflow.com/questions/10336899/java-what-is-a-question-mark-and-colon-within-the-parentheses-of-a-prin
    The 1st. answer nails it perfectly. The book lacks the alternate order to the if else statement:
    boolean statement ? true result : false result;

  • @DreamLyrics1313
    @DreamLyrics1313 12 років тому +2

    I'm really starting to appreciate the fact that I am learning all this in highschool. I'm learning University level programming in Grade 11.

  • @BeyondTheRecords
    @BeyondTheRecords 2 місяці тому

    New to Java..but this is all example right? I’ve learned that you have to start with public static void main[String] args)
    Great instructor! Just hard to run the terminal with his examples

  • @rockstarkate78
    @rockstarkate78 10 років тому +8

    Notice how the viewership drops with each class. 147K views for Lecture 7, 120K views for Lecture 8, 70K for Lecture 12.... etc.

    • @jessedu3363
      @jessedu3363 10 років тому +2

      It's usually the case for a lot of series on UA-cam. The first video gets a lot of views, and it decreases from there.

    • @iyadajeeb1986
      @iyadajeeb1986 9 років тому

      Jesse Hello Nope it's not, it's more like the case for a lot of students in College ... Drop outs and stuff!

  • @BoundMusic
    @BoundMusic 10 років тому +10

    This is the part where I'm kind of lost but push myself through

    • @rayez6565
      @rayez6565 9 років тому +6

      keep pushing brother

    • @BoundMusic
      @BoundMusic 9 років тому +4

      Thanks man. I needed that.

    • @dg-hughes
      @dg-hughes 7 років тому +5

      Don't forget to review often when you go back you see things in a different way some of it seems easier than the first run and other stuff clicks too; it's always smart to go back and review. Pushing ahead is good but you need to understand those fundamentals first, push review push review. My advice to a comment from two years ago :/

  • @BjazzK
    @BjazzK 12 років тому +1

    Great series, but an HD version could make parts of the lecture much more legible.

  • @TeeUniverse
    @TeeUniverse 11 років тому

    It must be awesome for students who is going to take this class next semester at Stanford to watch this whole class in advance. I wish I could do that:(

  • @LOSTxTRIUMPH
    @LOSTxTRIUMPH 12 років тому

    the 4 dislikers were students who got always got hit by rogue candies. ;)
    but on a side note, these lectures are making things so much easier. I'm actually learning more here than from my college instructors. You the man Sahami!!

  • @UmTheMuse
    @UmTheMuse 12 років тому

    A parameter is like a variable that you got from somewhere else. Think about that CD player the professor showed. The player comes with electronics and stuff. That's equivalent to having internally declared variables, right? Then, you stick a CD (a parameter) in. Depending on what the CD has written on it (what the variable points to), different things will happen.
    Params behave like vars, but they're applicable in more than one situation.

  • @aakksshhaayy
    @aakksshhaayy 15 років тому

    you have to get the acm library first, then import acm.graphics*; and import acm.program.*;
    associate the library with your project first.

  • @megametalpriest
    @megametalpriest 14 років тому

    This video explains polymorphism EXREMELY well

  • @Sintaxx2
    @Sintaxx2 12 років тому

    This guy is a genius!

  • @nikhilpatel11
    @nikhilpatel11 13 років тому

    @PapaWilk go to Stanford cs106a website they have assignment for this lectures.

  • @shywolf7145
    @shywolf7145 6 років тому +2

    Does anyone know if this information is still relevant for java in 2018? I noticed that some things seem slightly different, although the similarities seem to much overpower the differences, will I just be confusing myself by learning about an older version of java? Coming from a beginner who is just starting to grasp the basics of java.

    • @Guylovesleep6802
      @Guylovesleep6802 6 місяців тому

      Hey i am also new(and i know the comment is from 6 years ago) but this will give me a good foundation right? And later on can learn what the new version do?( well this is my plan, can you pls help me? If i should do this or not?)

  • @tokgozemre
    @tokgozemre 14 років тому +4

    damn those snacks. I can't focus the lecture!:)) I want one too!!

  • @Myshcan
    @Myshcan 15 років тому

    I finally got the checkerboard to print, albeit with an error warning. I noticed that the acm imports were in karel.jar. So I altered the checkerboardkarel so it was similar to checkerboard.java

  • @egemenozdemir724
    @egemenozdemir724 8 місяців тому +1

    2:05.while loop/loop and a half
    3:33.sentinel
    9:55. for vs ,loop
    11:10. checker board
    19:00. little smart thing and checker board
    22:00. methods in java
    30:12. creating methods in java
    34:00. return statement/expression
    35:00. example of a method
    40:42. factorial example
    46:46. returning objects
    49:24. how to add in to run method

  • @dbseraph
    @dbseraph 12 років тому

    The default color of a graphics object (sq) is black. He calls setFilled() without ever calling setColor(), so it will be black until he chooses to change it.

  • @mtomazza
    @mtomazza 14 років тому

    @Myshcan No, you should write your own new class.

  • @winstonlab
    @winstonlab 7 років тому +2

    Alice in Chains? man Mehran just gets more awesome every lecture

  • @SweetSpot909
    @SweetSpot909 12 років тому

    in the factorial example. In the run method in the for loop it says factorial(i). Could you have put factorial + i? Or is the correct way factorial(i)? Also when you call a method, is factorial a special case where you can put arguments in the parentheses when you call the factorial method?

  • @daniel10263
    @daniel10263 9 років тому +3

    Hey guys, if interested there is another CS106A from Stanford! (web.stanford.edu/class/cs106a/)
    It's kinda the same, but there is a lot of information there!

    • @IlyaHarri
      @IlyaHarri 9 років тому

      ***** Unfortunately all materials are locked. How did you get access to course materials?

    • @daniel10263
      @daniel10263 9 років тому +2

      IlyaHarri It was available until march... Try this one: web.stanford.edu/class/archive/cs/cs106a/cs106a.1134/lecture.html

    • @IlyaHarri
      @IlyaHarri 9 років тому

      ***** Thanks a lot!!!

    • @daniel10263
      @daniel10263 9 років тому

      :)

    • @iyadajeeb1986
      @iyadajeeb1986 9 років тому

      ***** Thanx a lot for the link ... But I don't understand, what is this ? Is this some other class ? Or just additional material ? What's the difference between the two ?

  • @SkitSophrenia
    @SkitSophrenia 14 років тому

    at 04:55 a much better way to do that would be to use a "do while" loop. It's just so much easier that way.

  • @djwhitenite
    @djwhitenite 11 років тому

    In 7 lectures talking at the speed of sound, I have not seen this guy take one sip of water. What a machine

  • @mallithemadman
    @mallithemadman 14 років тому

    i'm not done yet doing the checkerboard prog myself. I'm kinda leap without looking person...
    alright!
    Ideally X should be assigned the value of i in the for loop and Y should be assigned the value of j in the for loop, if we are printing Square boxes row wise but this program looks like we are printing it column wise... like x1y1 , x2y1, x3y1.... and then after the column completes. y goes for an increment which means the focus goes tothe second column... i'm fine with it otherwise.

  • @DerMagnar
    @DerMagnar 9 років тому +6

    Best teacher ever, but unfortunately alot of outdated things. For the loop and a half thing you only need a do{} while(); loop.
    public class Add {
    public static void main(String[] args) {
    int total = 0;
    int val;
    do{
    Scanner reader = new Scanner(System.in);
    System.out.println("Enter val:");
    val = reader.nextInt();
    total += val;
    }while (val !=0);
    System.out.println("your total is " + total);
    }
    }
    no constant SENTINEL, no break needed. works perfectly fine.
    It also happens, theres no more ConsoleProgram Class. Instead you need to create an object of a class that can read user input. For instance Scanner.
    stackoverflow.com/questions/5287538/how-to-get-basic-user-input-for-java
    btw. 6 weeks ago, i knew as much about programming as my grandmother. Learning all online on youtube and through pdf.s. Hell of a ride.

    • @bishavkharel4546
      @bishavkharel4546 7 років тому

      No unfortunately. What he did still works. There is no need for a sentinel value, but the sentinel value is used as good practice, that's what that was. And you need to download the acm.jar file to use the console program you're supposed to import it into eclipse. The scanner thing is not new it's old. Java doesn't change. He is using the readint(); method because they don't have to worry about the syntax of creating a scanner and the subtleties that go with it. That's why he uses public void run() {} instead of public static void main(String [] args) {} because he hasn't introduced methods or arrays yet.

    • @maikalaljaikisan6908
      @maikalaljaikisan6908 7 років тому

      Well, the video is 9 years old
      Maybe it wasn't outdated then

  • @EddieKMusic
    @EddieKMusic 11 років тому

    n is defined as a parameter in fractional(int n) method

  • @karjunreddy
    @karjunreddy 11 років тому

    oneTnx for the Lecture n one more for Apocalyptica

  • @EdwardHe9991
    @EdwardHe9991 12 років тому

    So cool

  • @Jimmt0
    @Jimmt0 12 років тому

    not sure which lecture to start at as I already learned Java...just looking for some reinforcement :P

  • @V62926685
    @V62926685 12 років тому

    Trying to! haha... Need more insight... hence further lessons followed by the C++ lessons :) I intend to write a complete program of some kind at some point here soon. Just need the basics.

  • @PetorialC
    @PetorialC 12 років тому

    You should not put "factorial + i" because it will treat "factorial" as a variable adding "i". To define it as a method you must put "()" at its end like this: "factorial()". Also in this case the factorial method must take in an integer(argument) as its parameter in order to run, so the "i" in "factorial(i)" must be there. (The "i" here is referring to the one of the for-loop in the run(), not the "i" in the factorial method!)

  • @Myshcan
    @Myshcan 15 років тому

    Trying to figure out how to run checkerboard.java in Stanford's Eclipse. Apparently I am missing the part that says how to create projects and classes. Or, is the project already in Stanford's version of Eclipse?

  • @qoaa
    @qoaa 11 років тому

    thanks! all working now :)

  • @TheSimCaptain
    @TheSimCaptain 11 років тому

    I can't see where the value of "n" is defined in the factorial program, as "i " has to be measured against it. It seems that a part of the code is missing. Surely "n" must be increasing by 1 every time before the factorial program can work on it.

  • @mohammadkarim5764
    @mohammadkarim5764 2 роки тому

    How can i get all the assignments, related to this class? Someone please help, I'm trying to learn java from the scratch.

  • @pker5range
    @pker5range 12 років тому

    instead of having the (int n) in the parameters for the private function, could you also leave the parameters empty and define a variable in the method itself?

  • @sitrakaforler8696
    @sitrakaforler8696 2 роки тому

    And it's free !

  • @buggy89
    @buggy89 11 років тому

    HD version will be nice indeed

  • @the_markwilson
    @the_markwilson 13 років тому

    Somehow it doesn't surprise me that a guy this awesome listens to Apocalyptica.

  • @EddieKMusic
    @EddieKMusic 12 років тому

    Head first java. Best book on java out there.

  • @X3QT0R
    @X3QT0R 15 років тому

    it happens with most of online lectures available on youtube.....@ mac

  • @SuperMasenka
    @SuperMasenka 15 років тому +1

    hey i took care of it,so what u need to do is download acm..and then import it in ur project...if u need details ill expalin it,its no biggy,trust me :-)

  • @MrRac121
    @MrRac121 11 років тому

    Hi,
    Can the definition of the factorial function be written in the run method ?
    If not, why ?
    Thanks.

  • @darkscorpionomega
    @darkscorpionomega 14 років тому

    @papawilk check out Sun's web site I know at one time they had testing materials on there. Otherwise a certification book would have a practice test in it. There is self test software you can get as well. I'd check with a teacher on it , I got mine for free from a class I took so not sure if there is a cost with it.

  • @qldps
    @qldps 12 років тому

    Some people learn out of pure interest, thus the 5 degrees. 5 topics of interest.

  • @hirtsdonut
    @hirtsdonut 14 років тому

    QUestion: if all calculations with pixels are done with ints why do the methods,
    getHeight(), getWidth(), and label.getAscent(), label.getWidth() return doubles?

  • @PetorialC
    @PetorialC 12 років тому

    @nkvd1000 Thankfully I learned a little bit of Java before so I didn't get lost in this video.

  • @PapaWilk
    @PapaWilk 14 років тому

    Is there some way to test ourselves on this information. Can anyone recommend an online quiz for java beginners or something?

  • @qoaa
    @qoaa 11 років тому +1

    Anyone know where I can find the class package to download they use so I can import it into Eclipse?
    they are using import acm.program.Console
    and in this example for readInt function it's using acm.program.console
    eclipse doesn't have the acm libraries by default
    and I can't find any way to download these libraries if someone can help me out send me a private message on youtube I'd greatly appreciate it

  • @SuperMasenka
    @SuperMasenka 15 років тому

    hey i need help,i just saw this lecture and wanteed to run this program on my computer but the thing is that i am workin in eclipse so it always says that this GRect cannot be resolved to a type,so can u tell me which class should i import? i would be really grateful :-)

  • @AhYaOk
    @AhYaOk 14 років тому

    this is a lifesaver. my teacher doesnt explain anything, the book sucks and he doesnt tell us what is covered on the exams! it might f up my gpa. a 4 credit class! if i get less than a b im screwed. transfer school requires a 3.5 !#!$

  • @SuperMasenka
    @SuperMasenka 15 років тому

    oh hi..it took a while for someone to reply,yes i know about that,i did get that library and stuff but the thing is i was typing java.acm.graphics, not acm.graphics without that java infront...i hate stupid mistakes,but thank you anyway,

  • @shazkingdom1702
    @shazkingdom1702 9 років тому +1

    nice eraser!

  • @SuperMasenka
    @SuperMasenka 15 років тому

    hi does anyone know what is the best youtube literature after these mahani's luctures,thanks

  • @ddubs123
    @ddubs123 13 років тому

    I tried duplicating his checkerboard example, and it either fills all the squares or unfills all the squares. Anyone know if something has changed in the newest Java to cause this?

  • @firecopy
    @firecopy 12 років тому

    You could say... (Takes off glasses)... Those for loops don't go eye to eye.

  • @stonewisestudios
    @stonewisestudios 15 років тому

    Having limited usage with Wild Blue Satellite Internet restricts me from watching them all... It's B.S. 250mb DL/Day these are 150-200mb... Damn good lectures though! I'd hate to be in the class getting beamed with candies though... | ! | : )

  • @ten.seconds
    @ten.seconds 12 років тому

    10:00 wait, the init part's scope is different..
    multiple "for"s with int i=0 is okay but multiple "int i=0"s would break stuff.

  • @rellsw02
    @rellsw02 11 років тому

    for getting user input, I do not see why he doesnt have to create a Scanner instance. Using readDataType seems way more simple, but still going to use a Scanner

  • @JM-ml3ch
    @JM-ml3ch 11 років тому +1

    I need those details

  • @ddubs123
    @ddubs123 13 років тому

    @dorohanter uh.. in the java environment

  • @Mahmoudkhteeb
    @Mahmoudkhteeb 12 років тому

    You need to import acm.graphics.*; and import acm.program.*;
    You will find the whole program here -> see.stanford(dot)edu/materials/icspmcs106a/12-control-statements.pdf

  • @nkvd1000
    @nkvd1000 13 років тому

    enjoying the lectures but this one is starting to get tough.........so much terminology to remember

  • @giuxss
    @giuxss 12 років тому

    Why does the method setFilled automatically fill the square with black?

  • @LinusLexfors
    @LinusLexfors 13 років тому

    @dorohanter I recommend using Eclipse, the IDE that their using in the videos, works great for me! ;D

  • @peko7722
    @peko7722 9 років тому

    i have problem, i am trying to rewrite CheckerBoard program as video show. in the last line, the "add(sq)", my Eclipse remind me:"The method add(Component) in the type Container is not applicable for the arguments (GRect)". rest of my code are totally same as video. anyone could teach me how to fix it?

    • @cybertech7428
      @cybertech7428 9 років тому

      Did you import the graphics program?
      Your code should look like this...
      /* File: CheckerBoard.java
      *
      * This is a graphics program that
      * draws a checker board
      */
      import acm.program.*;
      import acm.graphics.*;
      public class CheckerBoard extends GraphicsProgram{
      //number of rows
      private static final int NROWS = 8;
      //number of columns
      private static int NCOLUMNS = 8;
      //runs the program
      public void run(){
      int sqSize = getHeight() / NROWS;
      for( int i = 0; i < NROWS; i++){
      for(int j = 0; j < NCOLUMNS; j++){
      int x = j * sqSize;
      int y = i * sqSize;
      GRect sq = new GRect(x, y, sqSize, sqSize);
      sq.setFilled(((i + j) % 2) != 0);
      add(sq);
      }
      }
      }
      }

    • @peko7722
      @peko7722 9 років тому

      Craig Walker thank you so much, it's working.

    • @barakmichaeli
      @barakmichaeli 9 років тому

      Craig Walker i have the same problem but i do as u say and nothing happened, this is my code:
      import acm.program.*;
      import acm.graphics.*;
      import java.awt.*;
      public class theRobotFace extends ConsoleProgram {
      private static final double HEAD_WIDTH = 1;
      private static final double HEAD_HEIGHT = 3;
      private static final double EYE_RADIUS = 2;
      private static final double MOUTH_WIDTH = 2;
      private static final double MOUTH_HEIGHT = 2;
      public void run() {
      double placeX,placeY;
      placeX = (getWidth()/2)-(HEAD_WIDTH/2);
      placeY = (getHeight()/2)-(HEAD_HEIGHT/2);
      drawRect(placeX,placeY,HEAD_WIDTH,HEAD_HEIGHT,Color.gray);

      }
      private void drawRect(double x,double y,double width,double height, Color color){
      GRect rect = new GRect(x,y,width,height);
      rect.setFilled(true);
      rect.setFillColor(color);
      add(rect);
      }
      }

    • @cybertech7428
      @cybertech7428 9 років тому +1

      I'm pretty new to java as well, but I'll try to help you the best I can.
      1. Your class should be capitalized.
      2. You shouldn't be extending Console Program when working with Graphics.
      3. The parameters for your robot are way too small. The Width of your head is only 1 pixel. Play around with different numbers until you get the size of rectangle you want.

    • @LocNguyenCrypto
      @LocNguyenCrypto 9 років тому

      I think Its should give you a tiny dot in center of screen.

  • @a_abazine
    @a_abazine 7 років тому

    It is safe to declare a local variable inside a loop because it dies when arriving to loop end

    • @larissamogosi6858
      @larissamogosi6858 7 років тому

      Static variables are initialized only once, at the beginning - when the class is loading. They won't die at the end of the loop.

    • @a_abazine
      @a_abazine 7 років тому

      Yeah that is right, local variable shoulde be in the place of static variable in this case, confused with c/c++ (static variable // dynamic variable), take this Candy 🍬 .

    • @larissamogosi6858
      @larissamogosi6858 7 років тому

      :)

  • @Thegamer-yp7qq
    @Thegamer-yp7qq 8 років тому +1

    in 46:46
    fillcolor (double x
    double y
    double r)
    what is r ?

    • @jasongonzalez6632
      @jasongonzalez6632 8 років тому +4

      +The gamer 49:55 -- r is radius
      in order to make a circle you need a point and a radius. At the end he calls his method passes (10,10,2,Color.red) as arguments to his method --- After that , what happens is the values he passed in are passed INSIDE the braces to the GOval object's parameters so that it can make a new GOval and then set it's properties and return the variable circle back to the program at the same spot that called the filled circle function.PS---Don't let the words parameter and argument confuse you----there the same thing ---they just say parameter when you create a method and argument when you "call" a method --- either way its the stuff in inside the parentheses. Good LUck and Thank you Professor Mehran

    • @Thegamer-yp7qq
      @Thegamer-yp7qq 8 років тому

      +Jason Gonzalez thanks for ur help

  • @KenechiLearnsCode
    @KenechiLearnsCode 9 років тому

    The level of difficulty just went up lol. But it's still manageable. If it's worth having, it's worth working hard for.

  • @EdwardHe9991
    @EdwardHe9991 12 років тому

    What does he import to get readInt?

  • @mlukahot
    @mlukahot 6 років тому

    @6:40, more or less. Isn't the "break" instruction just like the infamous "goto" that gave rise to "spaghetti code", so many years ago and which "structured programming" was invented to avoid??? Personnaly, I think the first solution to this problem was better. Even if it meant "repeating" the same instruction twice...

  • @Jheekjhe
    @Jheekjhe 11 років тому

    Mehran Sahami, 1st place in Candy Throwing.

  • @josephedm794
    @josephedm794 8 років тому +1

    how match is the value of getHeight()?

    • @discord2000
      @discord2000 8 років тому +1

      +Joseph Edm It depends on how big the graphics window is when your program runs, and changes if you resize the window.
      You can display the value of getHeight() on the screen by sending it to a GLabel object:
      //code
      import acm.program.*;
      import acm.graphics.*;
      public class foo extends GraphicsProgram{
      public void run(){
      GLabel lab = new GLabel(String.valueOf(getHeight()),20,20);
      add(lab);
      }
      }

    • @josephedm794
      @josephedm794 8 років тому +1

      yes, but you will always have 8 rectangles no matter your height of the screen right?

    • @discord2000
      @discord2000 8 років тому +2

      +Joseph Edm If you change the constant NROWS, the number of rectangles (or rows) will change but the screen height stays the same. Therefore, you need to know the screen height to get the height of the rectangle. You have to specify the height of the rectangle to create it.

    • @josephedm794
      @josephedm794 8 років тому

      that's a hard part of programming, it's not easy to come up with that algorithm!

  • @Thegamer-yp7qq
    @Thegamer-yp7qq 8 років тому

    what is the addition of double r ( reduce ) ?

    • @somebody4061
      @somebody4061 8 років тому

      r is the radius of the circle (the distance from the center)