Jump to content

I am not here to ask for someone to code the whole program for me. However, I am currently stuck. I have an assignment and that assignment is to take the user's input and output the date for tomorrow and yesterday including leap year. 

 

I do not know where to start. All I need is like an "outline" sort of say, then from there I can get the "ball rolling."

 

Thank you

 

FYI, this is my first programming class.

CPU: Intel Core i7-4790K Quad-Core Processor | CPU Cooler: Corsair H100i 77.0 CFM Liquid CPU Cooler | Motherboard: MSI Z97-GAMING 7 ATX LGA1150 Motherboard | Memory: Corsair Vengeance 16GB | Storage: Samsung 840 EVO 500GB 2.5" Solid State Drive, Seagate 4TB 3.5" 5900RPM Internal Hard Drive | Video Card: EVGA GeForce GTX 970 3.5GB ACX 2.0 Video Card x2 SLI| Case: Corsair 450D ATX Mid Tower Case | Power SupplyEVGA SuperNOVA 750 G2 

 

Link to comment
https://linustechtips.com/topic/456031-need-help-with-java/
Share on other sites

Link to post
Share on other sites

as for the readout, you need "System.out.println()"

 

as for reading... guessing something "System.in"

 

otherwise, its just a matter of applying logic.

--

also, first programming class as in first year of taking programming, or as in "very first programming assignment"

 

because in the second case, i want to punch him in the face...

Link to comment
https://linustechtips.com/topic/456031-need-help-with-java/#findComment-6119678
Share on other sites

Link to post
Share on other sites

as for the readout, you need "System.out.println()"

 

as for reading... guessing something "System.in"

 

otherwise, its just a matter of applying logic.

--

also, first programming class as in first year of taking programming, or as in "very first programming assignment"

 

because in the second case, i want to punch him in the face...

xD first programming class.

 

Yeah... the logic part is where I am trying to wrap my head around. 

CPU: Intel Core i7-4790K Quad-Core Processor | CPU Cooler: Corsair H100i 77.0 CFM Liquid CPU Cooler | Motherboard: MSI Z97-GAMING 7 ATX LGA1150 Motherboard | Memory: Corsair Vengeance 16GB | Storage: Samsung 840 EVO 500GB 2.5" Solid State Drive, Seagate 4TB 3.5" 5900RPM Internal Hard Drive | Video Card: EVGA GeForce GTX 970 3.5GB ACX 2.0 Video Card x2 SLI| Case: Corsair 450D ATX Mid Tower Case | Power SupplyEVGA SuperNOVA 750 G2 

 

Link to comment
https://linustechtips.com/topic/456031-need-help-with-java/#findComment-6119692
Share on other sites

Link to post
Share on other sites

xD first programming class.

 

Yeah... the logic part is where I am trying to wrap my head around. 

as a default, your first program should be a "hello world"

 

as for the needed logic, this should get you rolling a bit: http://www.tutorialspoint.com/java/java_date_time.htm

 

EDIT: the guy at least taught about the syntaxes and control structures right?

Link to comment
https://linustechtips.com/topic/456031-need-help-with-java/#findComment-6119722
Share on other sites

Link to post
Share on other sites

as a default, your first program should be a "hello world"

 

as for the needed logic, this should get you rolling a bit: http://www.tutorialspoint.com/java/java_date_time.htm

 

EDIT: the guy at least taught about the syntaxes and control structures right?

Sorry, that's my fault for not explaining it clearly. We have done 4 minilab which is like small and sort program. This is our first real program.

CPU: Intel Core i7-4790K Quad-Core Processor | CPU Cooler: Corsair H100i 77.0 CFM Liquid CPU Cooler | Motherboard: MSI Z97-GAMING 7 ATX LGA1150 Motherboard | Memory: Corsair Vengeance 16GB | Storage: Samsung 840 EVO 500GB 2.5" Solid State Drive, Seagate 4TB 3.5" 5900RPM Internal Hard Drive | Video Card: EVGA GeForce GTX 970 3.5GB ACX 2.0 Video Card x2 SLI| Case: Corsair 450D ATX Mid Tower Case | Power SupplyEVGA SuperNOVA 750 G2 

 

Link to comment
https://linustechtips.com/topic/456031-need-help-with-java/#findComment-6119733
Share on other sites

Link to post
Share on other sites

Sorry, that's my fault for not explaining it clearly. We have done 4 minilab which is like small and sort program. This is our first real program.

ah. mkay. less punch-teeth worthy then.

 

but still... this is like something you get assigned as an extra task when the regular stuff is done...

 

basicly, what i'd do (and i'm a terrible programmer...) is make two date parameters.

 

you ask for a date in a specific format. (DD-MM-YYYY if you're metric, MM-DD-YYYY if you're imperial, and YYYY-MM-DD if you're a real programmer)

then you put that into the two date parameters. (this'll help: http://stackoverflow.com/questions/4216745/java-string-to-date-conversion )

from one, you substract a day (probably gonna have to go trough the "milliseconds since midnight jan 1 1970" notation... good luck with that one..)

to one, you add a day (same method, but adding instead of substracting)

then you use the toString method to print both of them.

Link to comment
https://linustechtips.com/topic/456031-need-help-with-java/#findComment-6119808
Share on other sites

Link to post
Share on other sites

ah. mkay. less punch-teeth worthy then.

 

but still... this is like something you get assigned as an extra task when the regular stuff is done...

 

basicly, what i'd do (and i'm a terrible programmer...) is make two date parameters.

 

you ask for a date in a specific format. (DD-MM-YYYY if you're metric, MM-DD-YYYY if you're imperial, and YYYY-MM-DD if you're a real programmer)

then you put that into the two date parameters. (this'll help: http://stackoverflow.com/questions/4216745/java-string-to-date-conversion )

from one, you substract a day (probably gonna have to go trough the "milliseconds since midnight jan 1 1970" notation... good luck with that one..)

to one, you add a day (same method, but adding instead of substracting)

then you use the toString method to print both of them.

Thank you for that info!

CPU: Intel Core i7-4790K Quad-Core Processor | CPU Cooler: Corsair H100i 77.0 CFM Liquid CPU Cooler | Motherboard: MSI Z97-GAMING 7 ATX LGA1150 Motherboard | Memory: Corsair Vengeance 16GB | Storage: Samsung 840 EVO 500GB 2.5" Solid State Drive, Seagate 4TB 3.5" 5900RPM Internal Hard Drive | Video Card: EVGA GeForce GTX 970 3.5GB ACX 2.0 Video Card x2 SLI| Case: Corsair 450D ATX Mid Tower Case | Power SupplyEVGA SuperNOVA 750 G2 

 

Link to comment
https://linustechtips.com/topic/456031-need-help-with-java/#findComment-6119824
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×