Newbie Coders Chat

Announcements Posted on
How helpful is our apprenticeship zone? Have your say with our short survey 02-12-2016
    Offline

    2
    ReputationRep:
    Hey, I'm trying to teach myself Python and HTML/CSS but it's a slow process.
    Offline

    3
    ReputationRep:
    (Original post by LogicalFallacy)
    Hey, I'm trying to teach myself Python and HTML/CSS but it's a slow process.
    Is there anything in particular that you're struggling with?
    Offline

    2
    ReputationRep:
    (Original post by _gcx)
    Is there anything in particular that you're struggling with?
    I'm going to be honest and say:
    1. Time
    2. Finding a space to experiment with HTML and CSS
    Online

    3
    ReputationRep:
    (Original post by 571122)
    It's been a while for me since I used the Scanner class, but I compiled and ran your code and I received no errors. Line 17 might be redundant, as you tell the Java compiler to wait for input before it closes the program, but you aren't further expecting any input, but maybe you just wanted the program to pause. I just typed in some random character followed by enter and the program closed as expected.

    Did you compile and run the code already?

    n.b.: the file name of your program has to be AboutMe.java
    Yes thanks 57, i compiled and ran my code, and i am fairly sure that i named the file correctly. Although some times i have doubts over even that.

    I have also taken a look at the second program we are asked to do, and my results are pretty bad, although to be honest with you i'm running out of patience. Although i suppose you need patience in spades to get the hang of this.

    I also don't know whether this second program is actually meant to compile (which would make sense), or if it is supposed to just demonstrate an executive functional block, without working itself. They don't make this clear. Here is my code for this one, see what you think...

    http://pastebin.com/j7b810AH

    BTW this one doesn't even compile, god help me!?

    Finally i have also looked at the next project i have to do, and thank hell it is a more mathematical based project, with some basic bolean operations, but i am hopeful that i can do better here. Although with things as there currently stand, i will be lucky to scrape a pass if i can't bring my grades up, on this other stuff!
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    I have also taken a look at the second program we are asked to do, and my results are pretty bad, although to be honest with you i'm running out of patience. Although i suppose you need patience in spades to get the hang of this.
    That's right, patience is critical in programming.

    I also don't know whether this second program is actually meant to compile (which would make sense), or if it is supposed to just demonstrate an executive functional block, without working itself. They don't make this clear. Here is my code for this one, see what you think...

    http://pastebin.com/j7b810AH

    BTW this one doesn't even compile, god help me!?
    I corrected it and now it compiles. Check it out here:
    http://pastebin.com/376JZa4c

    Here are the answers to your questions:
    - Yes, the second program is meant to compile and so it did after I amended it.
    - It is supposed to demonstrate Objected Oriented Programming, and more specifically the use of functions (methods that return a value; a method is a function that belongs to a class), their return values and using those.

    I ran the code now and the results are that it prints the following:
    I really like your shoes!
    What are THOSE?
    A few tips for further improvement:
    - When you write code, always make sure you open and close your braces before you do anything else, otherwise you might forget to close some braces and then your code will not be valid.
    - Don't add too much whitespace between code. Make it clean.
    - Always indent correctly (normally it's 4 spaces per tab for good style). Whatever you write inside a code block needs to be indented, i.e.: code inside a class needs to be indented 4 spaces after the 'public class' line. Code inside a method needs to be indented 4 spaces after the 'public someMethod()' declaration
    Online

    3
    ReputationRep:
    (Original post by 571122)
    That's right, patience is critical in programming.


    I corrected it and now it compiles. Check it out here:
    http://pastebin.com/376JZa4c

    Here are the answers to your questions:
    - Yes, the second program is meant to compile and so it did after I amended it.
    - It is supposed to demonstrate Objected Oriented Programming, and more specifically the use of functions (methods that return a value; a method is a function that belongs to a class), their return values and using those.

    I ran the code now and the results are that it prints the following:


    A few tips for further improvement:
    - When you write code, always make sure you open and close your braces before you do anything else, otherwise you might forget to close some braces and then your code will not be valid.
    - Don't add too much whitespace between code. Make it clean.
    - Always indent correctly (normally it's 4 spaces per tab for good style). Whatever you write inside a code block needs to be indented, i.e.: code inside a class needs to be indented 4 spaces after the 'public class' line. Code inside a method needs to be indented 4 spaces after the 'public someMethod()' declaration
    Thanks 57, do you want paying for this? If i pass the mooc, i can drop you a dollar or two, if that would help?
    Offline

    3
    ReputationRep:
    (Original post by 571122)
    That's right, patience is critical in programming.


    I corrected it and now it compiles. Check it out here:
    http://pastebin.com/376JZa4c

    Here are the answers to your questions:
    - Yes, the second program is meant to compile and so it did after I amended it.
    - It is supposed to demonstrate Objected Oriented Programming, and more specifically the use of functions (methods that return a value; a method is a function that belongs to a class), their return values and using those.

    I ran the code now and the results are that it prints the following:


    A few tips for further improvement:
    - When you write code, always make sure you open and close your braces before you do anything else, otherwise you might forget to close some braces and then your code will not be valid.
    - Don't add too much whitespace between code. Make it clean.
    - Always indent correctly (normally it's 4 spaces per tab for good style). Whatever you write inside a code block needs to be indented, i.e.: code inside a class needs to be indented 4 spaces after the 'public class' line. Code inside a method needs to be indented 4 spaces after the 'public someMethod()' declaration
    This isn't Python, indentation is irrelevant.
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    Thanks 57, do you want paying for this? If i pass the mooc, i can drop you a dollar or two, if that would help?
    Please ignore the comment lines 38-39-40 because I was not right about that. No need to pay me, for teaching and passing a student is the greatest reward. Knowledge is the greatest reward.
    Online

    3
    ReputationRep:
    (Original post by 571122)
    That's right, patience is critical in programming.


    I corrected it and now it compiles. Check it out here:
    http://pastebin.com/376JZa4c

    Here are the answers to your questions:
    - Yes, the second program is meant to compile and so it did after I amended it.
    - It is supposed to demonstrate Objected Oriented Programming, and more specifically the use of functions (methods that return a value; a method is a function that belongs to a class), their return values and using those.

    I ran the code now and the results are that it prints the following:


    A few tips for further improvement:
    - When you write code, always make sure you open and close your braces before you do anything else, otherwise you might forget to close some braces and then your code will not be valid.
    - Don't add too much whitespace between code. Make it clean.
    - Always indent correctly (normally it's 4 spaces per tab for good style). Whatever you write inside a code block needs to be indented, i.e.: code inside a class needs to be indented 4 spaces after the 'public class' line. Code inside a method needs to be indented 4 spaces after the 'public someMethod()' declaration
    Shoes.java:13: error: illegal start of expression
    public String goodShoes() {
    ^
    Shoes.java:13: error: ';' expected
    public String goodShoes() {
    ^
    Shoes.java:16: error: ';' expected
    Shoes gs= new Shoes("I really like your shoes!")
    ^
    Shoes.java:21: error: illegal start of expression
    public String badShoes() {
    ^
    Shoes.java:21: error: ';' expected
    public String badShoes() {
    ^
    Shoes.java:22: error: ';' expected
    Shoes bs= new Shoes("What are THOSE?")
    ^
    Shoes.java:27: error: illegal start of expression
    public static void main(String[] args) {
    ^
    Shoes.java:27: error: illegal start of expression
    public static void main(String[] args) {
    ^
    Shoes.java:27: error: ';' expected
    public static void main(String[] args) {
    ^
    Shoes.java:27: error: '.class' expected
    public static void main(String[] args) {
    ^
    Shoes.java:27: error: ';' expected
    public static void main(String[] args) {
    ^
    Shoes.java:30: error: illegal start of expression
    System.out.println(+goodShoes+) and System.out.printn(+badShoes+)
    ^
    Shoes.java:30: error: ';' expected
    System.out.println(+goodShoes+) and System.out.printn(+badShoes+)
    ^
    Shoes.java:30: error: ';' expected
    System.out.println(+goodShoes+) and System.out.printn(+badShoes+)
    ^
    Shoes.java:30: error: illegal start of expression
    System.out.println(+goodShoes+) and System.out.printn(+badShoes+)
    ^
    Shoes.java:30: error: ';' expected
    System.out.println(+goodShoes+) and System.out.printn(+badShoes+)
    ^
    Shoes.java:37: error: reached end of file while parsing
    }
    ^
    17 errors
    rm: cannot remove ‘*.class’: No such file or directory

    these are the runtime errors i get when i submit your code. Can you help me with any of these?
    Offline

    2
    ReputationRep:
    I'll look into it another day. Right now my time's up. Until then!
    Offline

    2
    ReputationRep:
    #include 'iwishiknewhowtocode'
    Offline

    0
    ReputationRep:
    Ye I done about 1 week on codeacademy, after the battlehip program thought lets try write one

    http://pastebin.com/2c29UW7X

    Very simple program but covers functions and loops and some external package. It took about 25-30 hrs of work. I found when I actually work at it rather than just ask on stackoverflow it feels way better when you figure it out yourself. Sometimes it helps to not just read the code over and over to see what's wrong but just get a paper and pen and think what youre trying to do and then putting it into code afterwards.

    I dont think Im cut out for it though just seems so painful and my concentreation is ****

    I don;t know what to do now, I thought a natural step would be to somehow store all my results from this program on a database and be able to recover them by date and then maybe install django and make this into a website. But I read that making a website with python is kinda long and unecessary so I might just play about with numpy and see wht I can do.
    Online

    3
    ReputationRep:
    (Original post by Nightowk)
    Ye I done about 1 week on codeacademy, after the battlehip program thought lets try write one

    http://pastebin.com/2c29UW7X

    Very simple program but covers functions and loops and some external package. It took about 25-30 hrs of work. I found when I actually work at it rather than just ask on stackoverflow it feels way better when you figure it out yourself. Sometimes it helps to not just read the code over and over to see what's wrong but just get a paper and pen and think what youre trying to do and then putting it into code afterwards.

    I dont think Im cut out for it though just seems so painful and my concentreation is ****

    I don;t know what to do now, I thought a natural step would be to somehow store all my results from this program on a database and be able to recover them by date and then maybe install django and make this into a website. But I read that making a website with python is kinda long and unecessary so I might just play about with numpy and see wht I can do.
    well done night owl, what language is it in, and what software would i need to compile/run it?
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    Shoes.java:13: error: illegal start of expression
    public String goodShoes() {
    ^
    Shoes.java:13: error: ';' expected
    public String goodShoes() {
    ^
    Shoes.java:16: error: ';' expected
    Shoes gs= new Shoes("I really like your shoes!"
    ^
    Shoes.java:21: error: illegal start of expression
    public String badShoes() {
    ^
    Shoes.java:21: error: ';' expected
    public String badShoes() {
    ^
    Shoes.java:22: error: ';' expected
    Shoes bs= new Shoes("What are THOSE?"
    ^
    Shoes.java:27: error: illegal start of expression
    public static void main(String[] args) {
    ^
    Shoes.java:27: error: illegal start of expression
    public static void main(String[] args) {
    ^
    Shoes.java:27: error: ';' expected
    public static void main(String[] args) {
    ^
    Shoes.java:27: error: '.class' expected
    public static void main(String[] args) {
    ^
    Shoes.java:27: error: ';' expected
    public static void main(String[] args) {
    ^
    Shoes.java:30: error: illegal start of expression
    System.out.println(+goodShoes+) and System.out.printn(+badShoes+)
    ^
    Shoes.java:30: error: ';' expected
    System.out.println(+goodShoes+) and System.out.printn(+badShoes+)
    ^
    Shoes.java:30: error: ';' expected
    System.out.println(+goodShoes+) and System.out.printn(+badShoes+)
    ^
    Shoes.java:30: error: illegal start of expression
    System.out.println(+goodShoes+) and System.out.printn(+badShoes+)
    ^
    Shoes.java:30: error: ';' expected
    System.out.println(+goodShoes+) and System.out.printn(+badShoes+)
    ^
    Shoes.java:37: error: reached end of file while parsing
    }
    ^
    17 errors
    rm: cannot remove ‘*.class’: No such file or directory

    these are the runtime errors i get when i submit your code. Can you help me with any of these?
    Remove all the comments from my code, that means all the /* and */ and // as well. Save it and compile it again.
    Offline

    3
    ReputationRep:
    Installed Linux on my laptop yesterday. For some reason whenever I try to put Linux on something it never goes as smoothly as it's supposed to, but got there in the end.

    Decided I'd do a little development project. Not sure what yet though. I've been thinking about learning Python or perhaps coding a GUI program using C++.
    Offline

    0
    ReputationRep:
    written in python i just run it using command prompt
    Online

    3
    ReputationRep:
    (Original post by 571122)
    Remove all the comments from my code, that means all the /* and */ and // as well. Save it and compile it again.
    For some reason 57, the shoes code is no longer showing the above errors, and only the following to runtime errors:

    2 errors found:File: C:\Users\john2\Shoes.java [line: 12]Error: Illegal modifier for parameter goodShoes; only final is permittedFile: C:\Users\john2\Shoes.java [line: 13]Error: Illegal modifier for parameter badShoes; only final is permitted

    here are lines 12 and 13 from the program:
    public String goodShoes = shoes.goodShoes(); public String badShoes = shoes.badShoes();

    I have exactly three days to sort this code out, and your help is much appreciated! John.
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    For some reason 57, the shoes code is no longer showing the above errors, and only the following to runtime errors:

    2 errors found:File: C:\Users\john2\Shoes.java [line: 12]Error: Illegal modifier for parameter goodShoes; only final is permittedFile: C:\Users\john2\Shoes.java [line: 13]Error: Illegal modifier for parameter badShoes; only final is permitted

    here are lines 12 and 13 from the program:
    public String goodShoes = shoes.goodShoes(); public String badShoes = shoes.badShoes();

    I have exactly three days to sort this code out, and your help is much appreciated! John.
    Please post all of the code in pastebin (yes, I know I wrote it, but still do it) so that I can look what's really going on.
    Online

    3
    ReputationRep:
    (Original post by 571122)
    Please post all of the code in pastebin (yes, I know I wrote it, but still do it) so that I can look what's really going on.
    here you go:

    http://pastebin.com/nvPgrk6T

    okay?
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    here you go:

    http://pastebin.com/nvPgrk6T

    okay?
    Remove 'public' from lines 12 and 13 and add the 'public' keyword before line 10.
    Your
    Code:
    public static void main
    should always be public.
 
 
 
Write a reply… Reply
Submit reply

Register

Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. Oops, you need to agree to our Ts&Cs to register
  2. Slide to join now Processing…

Updated: November 25, 2016
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Today on TSR
Poll
Would you rather have...?
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Quick reply
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.