Results 1 to 17 of 17
Like Tree1Likes
  • 1 Post By JosAH

Thread: assignment

  1. #1
    lemiso is offline Member
    Join Date
    Jul 2014
    Posts
    1
    Rep Power
    0

    Default assignment

    Q: Write a program that starts with a line of text and then outputs that line of text with the first occurence of "hate" changed to "love"

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: assignment

    Thank you for sharing your homework. If you have any trouble doing it, feel free to ask a specific question.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: assignment

    Of course, a PM was soon to follow.

    i cant figure it out hw this stuff work. can u help me out with it all
    My answer:

    You need to study like everyone else. Try eating some fruit, the glucose is important for a healthy brain.
    If you want to cut corners, programming is not for you. Do better.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: assignment

    (S)He's obviously management material.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  5. #5
    Matrice is offline Member
    Join Date
    Jul 2014
    Location
    Mililani
    Posts
    37
    Rep Power
    0

    Default Re: assignment

    Okay,
    I am a terrible beginner but nevertheless,

    public.main.void(String[] args)
    {
    System.out.println("hate");
    System.out.print("hove");
    }

    Run this on your compiler of your Eclipse of Netbeans or Bluej or jGRASP or any other IDE that you are using and the compiler should print out the result that you have requested.

    I am only a 6 hour old Java programmer so, if anyone else is going to read this, do reply to me! I am willing to learn this completely!

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,538
    Blog Entries
    7
    Rep Power
    20

    Default Re: assignment

    "love", not "hove". At least read the assignment text carefully ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    Matrice is offline Member
    Join Date
    Jul 2014
    Location
    Mililani
    Posts
    37
    Rep Power
    0

    Default Re: assignment

    Whoops,

    Thanks Jos. That, is known as a logical error, the syntax of my code is correct; however, the logic of my coding is incorrect because I wrote "hove" instead of "love".

  8. #8
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,538
    Blog Entries
    7
    Rep Power
    20

    Default Re: assignment

    Quote Originally Posted by Matrice View Post
    Whoops,

    Thanks Jos. That, is known as a logical error, the syntax of my code is correct; however, the logic of my coding is incorrect because I wrote "hove" instead of "love".
    The syntax of your code might be correct, the code doesn't do what your assignment text asked it to do; e.g. what if the text were "hahalolotetevevelotehavehatelove"?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #9
    Matrice is offline Member
    Join Date
    Jul 2014
    Location
    Mililani
    Posts
    37
    Rep Power
    0

    Default Re: assignment

    Umm..I feel like a baby right now, could you re-word that? I am only a day old. :( Sys out is my strongest understanding.

  10. #10
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: assignment

    Quote Originally Posted by Matrice View Post
    Umm..I feel like a baby right now, could you re-word that? I am only a day old. :( Sys out is my strongest understanding.
    Doesn't get better than this: "the code doesn't do what your assignment text asked it to do;". The assignment wants you to change words in a piece of text (Which we will refer to as a "String"). Your code doesn't do that.

    Imagine how you would approach this if this was on paper. Write down the steps as expicit as possible. When that's done, try translating that into Java code (OP are you listening??!). The exercise might want you replace something in the String. (There is a hint hidden in the last sentence...)
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  11. #11
    Matrice is offline Member
    Join Date
    Jul 2014
    Location
    Mililani
    Posts
    37
    Rep Power
    0

    Default Re: assignment

    I haven't gotten that far in my programming practice. I have only been doing basic, static sort of manipulation.

    Could you explain,

    What a string is? Is it a declaration?

  12. #12
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,619
    Rep Power
    5

    Default Re: assignment

    Quote Originally Posted by gimbal2 View Post
    Of course, a PM was soon to follow.
    I don't have that problem. My settings are configured to not accept PM's except from moderators and folks in my contact list. As I continue to participate in the forum I periodically update my list.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  13. #13
    Matrice is offline Member
    Join Date
    Jul 2014
    Location
    Mililani
    Posts
    37
    Rep Power
    0

    Default Re: assignment

    And lemiso left with only one forum post to his name for Java.

    Will this community be benefiticial to my struggle to master the basics of Java? I am just wondering.

  14. #14
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: assignment

    Quote Originally Posted by Matrice View Post
    I haven't gotten that far in my programming practice. I have only been doing basic, static sort of manipulation.

    Could you explain,

    What a string is? Is it a declaration?
    A sequence of characters: Strings (The Java™ Tutorials > Learning the Java Language > Numbers and Strings)
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  15. #15
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: assignment

    Quote Originally Posted by Matrice View Post
    Will this community be benefiticial to my struggle to master the basics of Java? I am just wondering.
    Depends on you. You have to do it, all anyone else can do is offer support but that support can only work for someone who takes control of their own learning path rather than having other people carve it out for them. This thread is the perfect example of what you DON'T do; a literal dump of the homework text, not even a tiny bit of effort made to add a single personal touch to the post!

    You'll find that in this forum, the focus is on helping people to learn and find answers and understanding themselves, not to provide solutions. That is met with plenty of resistance (sometimes verbally aggressive resistance) since it requires lots of personal effort.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  16. #16
    Matrice is offline Member
    Join Date
    Jul 2014
    Location
    Mililani
    Posts
    37
    Rep Power
    0

    Default Re: assignment

    Alright,

    Well I know that asking you guys for an answer is wrong to do.
    So, I can ask for assistance when I am stuck, and you guys can give me suggestions that can help give me the right idea to figure out how to solve the problem on my own.

  17. #17
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,538
    Blog Entries
    7
    Rep Power
    20

    Default Re: assignment

    Quote Originally Posted by Matrice View Post
    Alright,

    Well I know that asking you guys for an answer is wrong to do.
    So, I can ask for assistance when I am stuck, and you guys can give me suggestions that can help give me the right idea to figure out how to solve the problem on my own.
    True, you have to do your own homework. but first of all you have to study some more; I've seen you ask questions like "why are there so many curly braces in the code?"; it would've been like me, after studying an Arabic language for one day, asking "what are all those spaghetti blob thingies doing in my book?"; the question itself doesn't make any sense. You need to have a firm grip on the basics of the language first, i.e. what is a class? What does public static void main(String[] args) mean? And what are those square brackets doing there and what is a String? Why are those curly brackets needed? etc. etc.

    Before that, don't try to answer somebody else's question here; your answers won't make any sense; and don't try to read Java source code as if it was (part of) a novel; you can't read source code like that.

    kind regards,

    Jos
    gimbal2 likes this.
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. i need help with assignment
    By samwright92 in forum New To Java
    Replies: 5
    Last Post: 12-04-2012, 03:32 AM
  2. Need help with this assignment
    By shogunduk in forum New To Java
    Replies: 8
    Last Post: 09-25-2012, 04:20 AM
  3. Can anyone help me in my Assignment
    By nono in forum New To Java
    Replies: 18
    Last Post: 11-15-2010, 05:52 AM
  4. help with an assignment!
    By Tek in forum New To Java
    Replies: 6
    Last Post: 10-24-2010, 11:32 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
  •