Please HELP ASAP! I/O Command Line, How do you write them? System.in?

I'm trying to create a program where the user can enter a year and gets the date of Easter on that year he/she entered. So far i've implemented the Easter class which contains the methods for getting the day and month of Easter, but I'm trying to write the main class which is kind of tricky for me. The main class is supposed to be the one asking the user for the year. Except I don't even know what you have to write. I did a bit of research and eventually found something like this: " InputStreamReader cin = new InputStreamReader(System.in)" I realize that that is a constructor and that cin is actually a variable supposed to hold whatever the user inputs. Except I just want to make sure if that's kind of the guidelines on how to make it so that the user can enter something back. Also, I want the user to enter a year- so in other words an int type. Here's why:(The Implemented Class for Easter)
public void Year()
//Method body
public int getEasterSundayMonth(int y)
//Method Body
public int getEasterSundayDay(int y)
//Method Body
Yea I want to make it so that the user's input is "int y" that way I can perform my methods in order to give them back the day and month Easter is on. So my 2 questions are on how to write the code so I can get a user's input, and on how to substitute the user's input into the variable "y" I just started learning Java about 3 weeks ago as a Sophmore in high school, so it's a bit difficult for me. Thanks in advance.

You should really work on expressing yourself more succinctly.
shadowpal2 wrote:
I did a bit of research and eventually found something like this: " InputStreamReader cin = new InputStreamReader(System.in)" I realize that that is a constructor and that cin is actually a variable supposed to hold whatever the user inputs.You misunderstood. System.in is used to read standard input to the Java process. If you don't know what "standard input" is: basically it's stuff that you could type at the console when you're running the program, but it could be file content depending on how you invoke the program.
InputStreamReader is a class that takes that stream of input bytes and turns it into a stream of characters. It doesn't really hold anything.
Except I just want to make sure if that's kind of the guidelines on how to make it so that the user can enter something back.It's one way of many of getting user input. Actually it's only part of one common idiom for getting user input.
Also, I want the user to enter a year- so in other words an int type. Just use a java.util.Scanner.
Yea I want to make it so that the user's input is "int y" The user's input is always going to be characters. Scanner has methods to automatically turn input into other types. If you use something else (like the common idiom involving InputStreamReader) you'd need to convert the Strings you read into ints by hand, which isn't hard but why do it if Scanner does it for you?
Read the docs for java.util.Scanner.

Similar Messages

  • When I try to download songs from itunes it says I have to answer my security questions(which i made a year ago) I can't remember them, and I can't get on my email to reset the questions.. please help ASAP!

    I recieved an ipod 5 for a early christmas present a day ago, I already owned an ipod 4 so i just used my info from that ipod as a back up for my 5g. but now when i try to download music from itunes it says i must use my security questions (which i made over a year ago) I can't remember the answers and i can't get on the email that it sends the reset info to. i don't know what to do and its really frustrating. please help ASAP!

    You need to contact Apple to get the questions reset. Click here, phone them, and ask for the Account Security team, or fill out and submit this form.
    Whichever method you use, you probably won't get a response until the 26th. If you absolutely must make a purchase before then, create a new Apple ID; you won't be able to transfer previous purchases or iTunes Store credit to it.
    (95471)

  • My 2nd Gen ipod touch will not sync music i have bought on it to my computer... Please help asap!

    Whenever i plug it into itunes, it says Syncing, but when i click my purchased tab, only 218 of my 276 songs sync with the computer. I need to update my ipod soon, but before i can do this i have to make sure all of the songs are synced. All of them were purchased on itunes, using my touch.
    Please help ASAP! if there is any more information you need to help me with this, just email me or comment. thanks!
    [email protected]

    It sounds like you want to transfer iTunes purchases to your computer,  Try this:
    iTunes Store: Transferring purchases from your iPhone, iPad, or iPod to a computer

  • My office just bought me an iMac and I absolutely need to hook up a second monitor but there is no DVI connection on it, just a Thunderbolt. What do I do? Please help ASAP!!!

    My office just bought me an iMac and I absolutely need to hook up a second monitor but there is no DVI connection on it, just a Thunderbolt. What do I do? Please help ASAP!!! The imac is a 21.5" and they also already bought an HD 21.5 ASUS LCD monitor to attach to it. I'm really trying to make this setup work but this is becoming a nightmare. Any suggestions? I looked up  different VGA adapters but the only options for this would be a usb-vga connection which doesn't work on macs. Can anyone tell me if this new Thunderbolt connection will work in some way? Thanks

    Using the Thunderbolt port attach a Mini-display to DVI so long as the Asus display is equipped and capable, otherwise Mini-display to VGA will also work. The Thunderbolt port is ahead devices  which are not yet available to take advantage of the increased capacity in speed. Until the devices and connection cables are available, just use the port as a Mini-display port.

  • If my mom wants my Apple ID(I have no idea why), if she logs in on either her iPhone or our Mac can she see my IMessages ?? Please help ASAP!!!

    If my mom wants my Apple ID(I have no idea why), if she logs in on either her iPhone or our Mac can she see my IMessages ?? Please help ASAP!!!

    Yes, if she has your Apple ID & Password, she can see any messages that are sent to you as iMessages using another iOS device.

  • Hi I need a password, CPNU94094BO please help asap much needed

    Hi I need a password, CPNU94094BO  please help asap much needed

    Hi,
    In that case, the only option left to try would be to remove the rtc cell - see Page 63 of your Maintenance & Service Guide - then hold down the power button for 30 seconds.
    Leave the notebook like this for 20 minutes, then replace the rtc cell, reassemble and try booting again.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • Please help ASAP! I downloaded an app to change the Windows 10 login screen & now the screen flashes

    I downloaded Windows 10 Login Background Changer and now when my laptop starts I can't even get to the login screen. After the Acer screen at startup, it says "Please Wait...." but then the screen just flashes continually. Please help ASAP! Thank you!

    I did the exact same thing and had a very similar issue (flashing lock screen and couldn't get past the lock screen). I tried a system restore, resetting my PC, doing a clean install of Win10, and both methods of booting in SafeMode -- none of these methods worked. Called Microsoft several times; Level 1 tech told me to do a USB installation of Win10 (couldn't get my laptop to restart the way the USB installation needed); Level 2 tech told me to do a USB installation of Win8.1 (again did not work because my laptop could not restart properly). Gave up with tech support. The only way i was able to fix this problem was by choosing the "restore PC to factory settings" option. All your files and programs will be lost, but all of mine were already lost anyway after I tried doing a clean install of Win10. My laptop (S7-392) restored to Win8; I updated all my drivers and then made a recovery drive; did a USB installation of Win8.1, updated drivers and made another recovery drive. I have since done a USB installation of Win10 and upgraded my drivers. IF the same issue happens again i'll just end up reverting back to Win8.1 for a while.

  • I need an application which turn off wifi automaticly when my Ipod Toch is locked (for save battery charge), i hate every time to turn it off manually please help ASAP!!!

    I need an application which turn off WiFi automaticly when my Ipod Toch is locked (for save battery charge)
    I hate every time to turn it off manually when I go sleep please help ASAP!!!
    If I forget to turn of wifi on my device after my 8hour dream it's battery will be discharged. and ofcourse alert do not ring. pls help urgent!!!
    Thanks

    Suggestion:
    Turn off your device before bed.

  • What causes vertical color lines on ipad2 and how do you remove them ?

    What causes vertical color lines on an IPad. And how do you remove them ?

    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    If still present: Take it to an Apple Store for evaluation.
    Make a Genius Bar Reservation
    http://www.apple.com/retail/geniusbar/
    Don't believe it's a factor, but you should update your iOS.
    If you have an iPad 1, the max iOS is 5.1.1. For newer iPads, the current iOS is 6.1.3. The Settings>General>Software Update only appears if you have iOS 5.0 or higher currently installed.
    iOS 5: Updating your device to iOS 5 or Later
    http://support.apple.com/kb/HT4972
    How to install iOS 6
    http://www.macworld.com/article/2010061/hands-on-with-ios-6-installation.html
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    If you are currently running an iOS lower than 5.0, connect the iPad to the computer, open iTunes. Then select the iPad under the Devices heading on the left, click on the Summary tab and then click on Check for Update.
    Tip - If connected to your computer, you may need to disable your firewall and anitvirus software temporarily.  Then download and install the iOS update. Be sure and backup your iPad before the iOS update. After you update an iPad (except iPad 1) to iOS 6.x, the next update can be installed via wifi (i.e., not connected to your computer).
    Tip 2 - If you're updating via wifi, place your iPad close to your router to preclude getting a corrupted download.
     Cheers, Tom

  • Error 1004 appear when I'm trying to download the Hidden Object: Gardens in times Please help to slove the matter.. Thank you

    Appear "Error 1004" when trying to downloads all the apps in apps store....
    Can't purchase the apps with the updated payment methods as well...
    Please help and kindly advise further..
    Thank you....

    For Error 1004, look at this post
    https://discussions.apple.com/message/16228784
     Cheers, Tom

  • Please help me to rest the security question i have forget them please i hope you help me right way

    please help me to rest the security question i have forget them please i hope you help me right way

    Call Apple to help reset your Security Question.
    http://support.apple.com/kb/HT5699

  • Hello, I want to switch form a individual account to a team/business account? Can you please help me? I need this urgent Thank you!

    Hello, I want to switch form a individual account to a team/business account? Can you please help me? I need this urgent Thank you!

    Hi Koen,
    Please refer the following help article under "Purchasing Creative Cloud for Team".
    Creative Cloud Help | Creative Cloud for teams
    Hope this helps.
    Regards,
    Sumit Singh

  • Several items on a layout seem to be locked/uneditable--how do you unlock them?

    Several items on a layout seem to be locked/uneditable--how do you unlock them?  When I click on a given item in Design mode, I get a circle with a line through it; if I switch to code view, I see the code but it's grayed out.  What to do?  Please help.

    Is this a page created from a template?
    Can you upload the pages to a server and post a link - otherwise it's only going to be a guessing game as to what the problem may be?
    Nadia
    Adobe® Community Expert : Dreamweaver
    http://www.perrelink.com.au
    Unique CSS Templates | Tutorials | SEO Articles
    http://www.DreamweaverResources.com
    http://twitter.com/nadiap

  • What are answer points and how do you get them?

    What are answer points and how do you get them?

    If you read the Help & Terms of Use over there --->
    You will find this and more:
    How do I get points for answering questions?
    "If you submit a reply to another member's question topic, you are eligible to receive points from that member. The originator has the option of marking a reply as either Helpful or Solved, which will add points to the respondent's account. These points will, in turn, increase a member's ranking (status level) in the community over time."
    Regards,
    Colin R.

  • If you know your password to iTunes but forgot your sercurity questions how would you change them?

    If you know your password to iTunes but don't know your sercurity question answers how do you change them?

    Welcome to the Apple Community.
        1.    Start here (change country if necessary) and navigate to 'Password and Security', reset your security questions using the link provided, you will receive an email to your rescue address, use the link in the email and reset your security questions.
        2.    If that doesn't help, you don't receive a reset email or you don't have a rescue address, you should contact AppleCare who will initially try to assist you with a reset email or if unsuccessful will pass you to the security team to reset your security questions for you.
        3.    If you are in a region that doesn't have international telephone support try contacting Apple through iTunes Store Support.

Maybe you are looking for