Join TSR now and chat about whatever you’re intoSign up now

Newbie Coders Chat Watch

    Offline

    3
    ReputationRep:
    (Original post by BobBobson)
    First thing is that the question was asking you to create a static method in the LeapYear class that takes an int and returns a boolean. You're overcomplicating it by have constructors, instance variables etc. All you need is that one static method, and main which should call it a few times..
    Can you show me, at least some of the code, i need for this? I don't know how to do what you have told me Bob?!
    Offline

    1
    ReputationRep:
    (Original post by john2054)
    Hi my good friend. Here are the latest programs i would greatly appreciate your help with:

    Attachment 585208

    http://pastebin.com/9QWb1duP

    http://pastebin.com/Nm5wdZpF

    Thanks!
    bool isleap(int year)
    {
    return year % 4 == 0 && year % 100 || year % 400 == 0;
    }
    Offline

    3
    ReputationRep:
    (Original post by john2054)
    Hi my good friend. Here are the latest programs i would greatly appreciate your help with:

    Attachment 585208

    http://pastebin.com/9QWb1duP

    http://pastebin.com/Nm5wdZpF

    Thanks!
    http://pastebin.com/D5nVgcQK
    You're welcome!
    Offline

    3
    ReputationRep:
    (Original post by john2054)
    http://pastebin.com/4UYWgDAZ

    Is this one any better??
    Yeah that's better, but I would put that if statement within its own boolean method - boolean isLeapYear(), just to keep main as clean as possible, so it will be like:
    Code:
    static boolean isLeapYear (int year){
        if (...)
            return ...;
        else
            return ...;
    }
    and then in main, after receiving the year from the user you could have something like:
    Code:
    public static void main (String[] args) {
        if (isLeapYear(year))
            ...
        else
            ...
    }
    Also, I'm not sure whether it's pastebin, but the whitespace seems very off and it's making things hard to follow.
    Offline

    3
    ReputationRep:
    (Original post by 571122)
    http://pastebin.com/D5nVgcQK
    You're welcome!
    (Original post by BobBobson)
    Yeah that's better, but I would put that if statement within its own boolean method - boolean isLeapYear(), just to keep main as clean as possible, so it will be like:
    Code:
    static boolean isLeapYear (int year){
        if (...)
            return ...;
        else
            return ...;
    }
    and then in main, after receiving the year from the user you could have something like:
    Code:
    public static void main (String[] args) {
        if (isLeapYear(year))
            ...
        else
            ...
    }
    Also, I'm not sure whether it's pastebin, but the whitespace seems very off and it's making things hard to follow.
    Thanks guys, i have now passed the course, thank hell!
    Offline

    3
    ReputationRep:
    Does anyone here know which websites/books I can use to practice Java? From scratch ideally... thank you.

    Posted from TSR Mobile
    Offline

    3
    ReputationRep:
    (Original post by Enginerd.)
    Does anyone here know which websites/books I can use to practice Java? From scratch ideally... thank you.

    Posted from TSR Mobile
    http://www.headfirstlabs.com/books/hfjava/
    Offline

    3
    ReputationRep:
    (Original post by Enginerd.)
    Does anyone here know which websites/books I can use to practice Java? From scratch ideally... thank you.

    Posted from TSR Mobile
    https://docs.oracle.com/javase/tutorial/

    I taught myself java from there. It's the official tutorial made by Oracle.
    Offline

    3
    ReputationRep:
    (Original post by BobBobson)
    https://docs.oracle.com/javase/tutorial/

    I taught myself java from there. It's the official tutorial made by Oracle.
    Thanks, appreciate it

    Posted from TSR Mobile
    Offline

    3
    ReputationRep:
    (Original post by john2054)
    Thanks guys, i have now passed the course, thank hell!
    Thank heaven, that is.
    • Thread Starter
    Offline

    3
    ReputationRep:
    So that's why JavaScript is such a pain to learn
    https://hackernoon.com/how-it-feels-...77f#.87w8sexys
    Offline

    3
    ReputationRep:
    Of course.
    Offline

    3
    ReputationRep:
    (Original post by Craghyrax)
    So that's why JavaScript is such a pain to learn
    https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f#.87w8sexys
    lol
    Offline

    3
    ReputationRep:
    (Original post by Craghyrax)
    So that's why JavaScript is such a pain to learn
    https://hackernoon.com/how-it-feels-...77f#.87w8sexys
    I'm sticking with OOP and angular even if its "so 2015" jumping on every bandwagon like that will not end well.

    I mean the real sad thing is your jumping through all those hoops to achieve what real languages do strait out the box.
    Offline

    3
    ReputationRep:
    (Original post by INTit)
    I'm sticking with OOP and angular even if its "so 2015" jumping on every bandwagon like that will not end well.

    I mean the real sad thing is your jumping through all those hoops to achieve what real languages do strait out the box.
    I don't know if i can be bothered to do the last week of this course, seeing as i have now achieved a passing grade, and it is not going to go up any more?
    Online

    3
    ReputationRep:
    Does anyone know if it is possible to download Linux to a USB pen in order to boot it to onto a Windows 10 laptop (without creating a partition on the laptop itself), and then being able to actually save stuff onto the USB pen too?

    I have to use Fortran as a part of my degree and would like to be able to program at home too, but I don't want to have a partition on my laptop.
    Thanks
    Offline

    3
    ReputationRep:
    (Original post by l1lvink)
    Does anyone know if it is possible to download Linux to a USB pen in order to boot it to onto a Windows 10 laptop (without creating a partition on the laptop itself), and then being able to actually save stuff onto the USB pen too?

    I have to use Fortran as a part of my degree and would like to be able to program at home too, but I don't want to have a partition on my laptop.
    Thanks
    You definitely can, but I would question why you wouldn't want to have an actual partition on your pc.

    This is a pretty good guide:
    http://www.howtogeek.com/howto/13379...b-flash-drive/

    and is also has an alternative method using a virtual machine:
    http://www.howtogeek.com/97177/how-t...hout-the-mess/
    Online

    3
    ReputationRep:
    (Original post by l1lvink)
    Does anyone know if it is possible to download Linux to a USB pen in order to boot it to onto a Windows 10 laptop (without creating a partition on the laptop itself), and then being able to actually save stuff onto the USB pen too?

    I have to use Fortran as a part of my degree and would like to be able to program at home too, but I don't want to have a partition on my laptop.
    Thanks
    Fortran IDEs exist on Windows, Code::Blocks is the one that pops to mind.
    • Very Important Poster
    • Study Helper
    • Welcome Squad
    Offline

    3
    ReputationRep:
    ****. I've been doing real real real badly recently! I will get back into it from MONDAY!!! I hope!! Everyone, keep me accountable!
    Online

    3
    ReputationRep:
    (Original post by BobBobson)
    You definitely can, but I would question why you wouldn't want to have an actual partition on your pc.

    This is a pretty good guide:
    http://www.howtogeek.com/howto/13379...b-flash-drive/

    and is also has an alternative method using a virtual machine:
    http://www.howtogeek.com/97177/how-t...hout-the-mess/
    A few reasons that I didn't want to have a partition: I don't really know what I'm doing, so I'd prefer to do a simpler/safer way, especially since some places say that creating an actual partition can cause problems if done incorrectly.
    Thanks for the link. Can I still save Fortran files on the USB if I do it that way?

    (Original post by _gcx)
    Fortran IDEs exist on Windows, Code::Blocks is the one that pops to mind.
    If I use code::blocks, will it be the same as if I were to be using Linux (ie, text editors, terminal etc)? And can I save stuff using that?
 
 
 
Poll
Is GoT overrated?
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.