Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Rant on CPSC Class

Rant on CPSC Class

Scheduled Pinned Locked Moved The Lounge
javadata-structuresquestion
20 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gwenio
    wrote on last edited by
    #1

    ... or to be more exact something on the last test. The teacher decided to take off a point because I wrote static in a method declaration. There was no reason for the method to NOT be static. :( The question I wrote the method for said, "Write a method that reads in three floating point numbers and put them into an array." My answer was as follows:

    public static void ReadF3(float arr[]) {
    Scanner cin = new Scanner(System.in);
    for (int x=0; x<3; x++) {
    System.out.print("Enter a number: ");

    = cin.nextFloat();

    }
    }

    In case anyone is wondering, the langauge is Java. If she just wanted to take a point off, at least she could have done it for something that was wrong like that fact that I did not check the length of the array. In any case, when the same question showed up on the final today, I did the same thing, only with a diffrent method name and I did check the length of the array. I also included comments (on the final there was more space) that said that making it static is correct and explained why. PS: I still got a 91 on the test the question first showed up on, so it was not a big deal. However, I dislike losing points for something I did right.

    A L M 4 Replies Last reply
    0
    • G Gwenio

      ... or to be more exact something on the last test. The teacher decided to take off a point because I wrote static in a method declaration. There was no reason for the method to NOT be static. :( The question I wrote the method for said, "Write a method that reads in three floating point numbers and put them into an array." My answer was as follows:

      public static void ReadF3(float arr[]) {
      Scanner cin = new Scanner(System.in);
      for (int x=0; x<3; x++) {
      System.out.print("Enter a number: ");

      = cin.nextFloat();

      }
      }

      In case anyone is wondering, the langauge is Java. If she just wanted to take a point off, at least she could have done it for something that was wrong like that fact that I did not check the length of the array. In any case, when the same question showed up on the final today, I did the same thing, only with a diffrent method name and I did check the length of the array. I also included comments (on the final there was more space) that said that making it static is correct and explained why. PS: I still got a 91 on the test the question first showed up on, so it was not a big deal. However, I dislike losing points for something I did right.

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #2

      I'd have personally returned the array from the function rather than accepting it as a parameter. How do arrays work in Java? If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function? Or does the function copy the array? And are you sure she took off points because the method was static? Did she just point an arrow with a question mark, or did she say "you should not have made this function static" without any reason as to why? If so, I would have talked to her personally and asked why she marked me down and then explained my point of view. Even teachers have off days and grade subjectively.

      [Forum Guidelines]

      S V G 3 Replies Last reply
      0
      • G Gwenio

        ... or to be more exact something on the last test. The teacher decided to take off a point because I wrote static in a method declaration. There was no reason for the method to NOT be static. :( The question I wrote the method for said, "Write a method that reads in three floating point numbers and put them into an array." My answer was as follows:

        public static void ReadF3(float arr[]) {
        Scanner cin = new Scanner(System.in);
        for (int x=0; x<3; x++) {
        System.out.print("Enter a number: ");

        = cin.nextFloat();

        }
        }

        In case anyone is wondering, the langauge is Java. If she just wanted to take a point off, at least she could have done it for something that was wrong like that fact that I did not check the length of the array. In any case, when the same question showed up on the final today, I did the same thing, only with a diffrent method name and I did check the length of the array. I also included comments (on the final there was more space) that said that making it static is correct and explained why. PS: I still got a 91 on the test the question first showed up on, so it was not a big deal. However, I dislike losing points for something I did right.

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        Gwenio wrote:

        The teacher decided to take off a point because I wrote static in a method declaration.

        Your teacher is an idiot. Will make you wonder when you reach access modifiers, if he will get that right...

        xacc.ide
        IronScheme - 1.0 RC 1 - out now!
        ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

        A G 2 Replies Last reply
        0
        • L leppie

          Gwenio wrote:

          The teacher decided to take off a point because I wrote static in a method declaration.

          Your teacher is an idiot. Will make you wonder when you reach access modifiers, if he will get that right...

          xacc.ide
          IronScheme - 1.0 RC 1 - out now!
          ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

          A Offline
          A Offline
          AspDotNetDev
          wrote on last edited by
          #4

          leppie wrote:

          if heshe will get that right

          FTFY.

          [Forum Guidelines]

          1 Reply Last reply
          0
          • A AspDotNetDev

            I'd have personally returned the array from the function rather than accepting it as a parameter. How do arrays work in Java? If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function? Or does the function copy the array? And are you sure she took off points because the method was static? Did she just point an arrow with a question mark, or did she say "you should not have made this function static" without any reason as to why? If so, I would have talked to her personally and asked why she marked me down and then explained my point of view. Even teachers have off days and grade subjectively.

            [Forum Guidelines]

            S Offline
            S Offline
            S Senthil Kumar
            wrote on last edited by
            #5

            aspdotnetdev wrote:

            If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function

            Everything is a reference type in Java, except for language defined types like int, float etc..

            Regards Senthil _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro

            A 1 Reply Last reply
            0
            • S S Senthil Kumar

              aspdotnetdev wrote:

              If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function

              Everything is a reference type in Java, except for language defined types like int, float etc..

              Regards Senthil _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro

              A Offline
              A Offline
              AspDotNetDev
              wrote on last edited by
              #6

              Gotcha. Perhaps it's time I refreshed my Java skills. Been a few years.

              [Forum Guidelines]

              L 1 Reply Last reply
              0
              • A AspDotNetDev

                Gotcha. Perhaps it's time I refreshed my Java skills. Been a few years.

                [Forum Guidelines]

                L Offline
                L Offline
                leppie
                wrote on last edited by
                #7

                aspdotnetdev wrote:

                Perhaps it's time I refreshed my Java skills. Been a few years.

                Step back and ask yourself if you really need that ;P

                xacc.ide
                IronScheme - 1.0 RC 1 - out now!
                ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                A 1 Reply Last reply
                0
                • L leppie

                  aspdotnetdev wrote:

                  Perhaps it's time I refreshed my Java skills. Been a few years.

                  Step back and ask yourself if you really need that ;P

                  xacc.ide
                  IronScheme - 1.0 RC 1 - out now!
                  ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                  A Offline
                  A Offline
                  AspDotNetDev
                  wrote on last edited by
                  #8

                  I was thinking that silently to myself... didn't want to upset any of the Java fans. My biggest problem with Java from the college class I studied it in like 5 years back was that the IDE wasn't very good. I'm sure that has changed.

                  [Forum Guidelines]

                  M L 2 Replies Last reply
                  0
                  • A AspDotNetDev

                    I was thinking that silently to myself... didn't want to upset any of the Java fans. My biggest problem with Java from the college class I studied it in like 5 years back was that the IDE wasn't very good. I'm sure that has changed.

                    [Forum Guidelines]

                    M Offline
                    M Offline
                    Mustafa Ismail Mustafa
                    wrote on last edited by
                    #9

                    aspdotnetdev wrote:

                    I was thinking that silently to myself... didn't want to upset any of the Java fans. My biggest problem with Java from the college class I studied it in like 5 years back was that the IDE wasn't very good. I'm sure that has not changed.

                    There, that should hold...

                    If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                    A 1 Reply Last reply
                    0
                    • M Mustafa Ismail Mustafa

                      aspdotnetdev wrote:

                      I was thinking that silently to myself... didn't want to upset any of the Java fans. My biggest problem with Java from the college class I studied it in like 5 years back was that the IDE wasn't very good. I'm sure that has not changed.

                      There, that should hold...

                      If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                      A Offline
                      A Offline
                      AspDotNetDev
                      wrote on last edited by
                      #10

                      Careful, with an opinion like that, you might get some people red faced with anger.

                      [Forum Guidelines]

                      M L 2 Replies Last reply
                      0
                      • A AspDotNetDev

                        Careful, with an opinion like that, you might get some people red faced with anger.

                        [Forum Guidelines]

                        M Offline
                        M Offline
                        Mustafa Ismail Mustafa
                        wrote on last edited by
                        #11

                        meh

                        If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                        A 1 Reply Last reply
                        0
                        • M Mustafa Ismail Mustafa

                          meh

                          If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                          A Offline
                          A Offline
                          AspDotNetDev
                          wrote on last edited by
                          #12

                          There is a Facebook page for fans of "meh". I'd suggest you become a fan, but you'd probably just say "meh" ;P

                          [Forum Guidelines]

                          1 Reply Last reply
                          0
                          • G Gwenio

                            ... or to be more exact something on the last test. The teacher decided to take off a point because I wrote static in a method declaration. There was no reason for the method to NOT be static. :( The question I wrote the method for said, "Write a method that reads in three floating point numbers and put them into an array." My answer was as follows:

                            public static void ReadF3(float arr[]) {
                            Scanner cin = new Scanner(System.in);
                            for (int x=0; x<3; x++) {
                            System.out.print("Enter a number: ");

                            = cin.nextFloat();

                            }
                            }

                            In case anyone is wondering, the langauge is Java. If she just wanted to take a point off, at least she could have done it for something that was wrong like that fact that I did not check the length of the array. In any case, when the same question showed up on the final today, I did the same thing, only with a diffrent method name and I did check the length of the array. I also included comments (on the final there was more space) that said that making it static is correct and explained why. PS: I still got a 91 on the test the question first showed up on, so it was not a big deal. However, I dislike losing points for something I did right.

                            M Offline
                            M Offline
                            Mark_Wallace
                            wrote on last edited by
                            #13

                            I'd have deducted another point because you used Java. Don't bother me with technicalities like "it's a Java course!"; I'm not interested. Hand the point over.

                            I wanna be a eunuchs developer! Pass me a bread knife!

                            G 1 Reply Last reply
                            0
                            • G Gwenio

                              ... or to be more exact something on the last test. The teacher decided to take off a point because I wrote static in a method declaration. There was no reason for the method to NOT be static. :( The question I wrote the method for said, "Write a method that reads in three floating point numbers and put them into an array." My answer was as follows:

                              public static void ReadF3(float arr[]) {
                              Scanner cin = new Scanner(System.in);
                              for (int x=0; x<3; x++) {
                              System.out.print("Enter a number: ");

                              = cin.nextFloat();

                              }
                              }

                              In case anyone is wondering, the langauge is Java. If she just wanted to take a point off, at least she could have done it for something that was wrong like that fact that I did not check the length of the array. In any case, when the same question showed up on the final today, I did the same thing, only with a diffrent method name and I did check the length of the array. I also included comments (on the final there was more space) that said that making it static is correct and explained why. PS: I still got a 91 on the test the question first showed up on, so it was not a big deal. However, I dislike losing points for something I did right.

                              M Offline
                              M Offline
                              Mark_Wallace
                              wrote on last edited by
                              #14

                              By the way (having actually looked at the code), why isn't your scanner final?

                              I wanna be a eunuchs developer! Pass me a bread knife!

                              1 Reply Last reply
                              0
                              • A AspDotNetDev

                                I was thinking that silently to myself... didn't want to upset any of the Java fans. My biggest problem with Java from the college class I studied it in like 5 years back was that the IDE wasn't very good. I'm sure that has changed.

                                [Forum Guidelines]

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #15

                                aspdotnetdev wrote:

                                I'm sure that has changed.

                                I spent a good part of the last two years working with NetBeans. As I've said before, compared to VS it was a breath of fresh air. It works, it's stable, and it's easily and regularly updated via the web, and it's FREE. As opposed to VS - unstable bloatware, updated once every two years at a cost designed to counter MS's falling profits elsewhere. ;P

                                1 Reply Last reply
                                0
                                • A AspDotNetDev

                                  Careful, with an opinion like that, you might get some people red faced with anger.

                                  [Forum Guidelines]

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #16

                                  aspdotnetdev wrote:

                                  you might get some people red faced with anger.

                                  Meh. Uneducated rants are more likely to make the ranter look like an idiot than anything else. ;)

                                  1 Reply Last reply
                                  0
                                  • A AspDotNetDev

                                    I'd have personally returned the array from the function rather than accepting it as a parameter. How do arrays work in Java? If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function? Or does the function copy the array? And are you sure she took off points because the method was static? Did she just point an arrow with a question mark, or did she say "you should not have made this function static" without any reason as to why? If so, I would have talked to her personally and asked why she marked me down and then explained my point of view. Even teachers have off days and grade subjectively.

                                    [Forum Guidelines]

                                    V Offline
                                    V Offline
                                    Vikram A Punathambekar
                                    wrote on last edited by
                                    #17

                                    aspdotnetdev wrote:

                                    How do arrays work in Java?

                                    Same as C#. Only, in C#, you have the extra power the ref keyword gives you, but I've personally never seen a single case where it has been used as intended.

                                    Cheers, Vikram. (Got my troika of CCCs!)

                                    1 Reply Last reply
                                    0
                                    • A AspDotNetDev

                                      I'd have personally returned the array from the function rather than accepting it as a parameter. How do arrays work in Java? If you pass an array to a function, and the function modifies that array, will the array be modified once you return from that function? Or does the function copy the array? And are you sure she took off points because the method was static? Did she just point an arrow with a question mark, or did she say "you should not have made this function static" without any reason as to why? If so, I would have talked to her personally and asked why she marked me down and then explained my point of view. Even teachers have off days and grade subjectively.

                                      [Forum Guidelines]

                                      G Offline
                                      G Offline
                                      Gwenio
                                      wrote on last edited by
                                      #18

                                      As sure as I can be. She had crossed out the word static, which was the only mark on the function other than a "-1".

                                      1 Reply Last reply
                                      0
                                      • L leppie

                                        Gwenio wrote:

                                        The teacher decided to take off a point because I wrote static in a method declaration.

                                        Your teacher is an idiot. Will make you wonder when you reach access modifiers, if he will get that right...

                                        xacc.ide
                                        IronScheme - 1.0 RC 1 - out now!
                                        ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                                        G Offline
                                        G Offline
                                        Gwenio
                                        wrote on last edited by
                                        #19

                                        Next semester I will have the other teacher who does the basic courses of Computer Science, so hopefully they will do better.

                                        1 Reply Last reply
                                        0
                                        • M Mark_Wallace

                                          I'd have deducted another point because you used Java. Don't bother me with technicalities like "it's a Java course!"; I'm not interested. Hand the point over.

                                          I wanna be a eunuchs developer! Pass me a bread knife!

                                          G Offline
                                          G Offline
                                          Gwenio
                                          wrote on last edited by
                                          #20

                                          It is better than what my High School teacher wanted to switch over to. He wish the AP course would do VB instead of Java. Personally I preffer C++ to either one.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups