Help with Input Output error

I am learning java and when I got to input output (the sample program is a BMI calculator) in my book i had to stop because i got a weird error.
Error:
BMICalculator.java:17 cannot find symbol
symbol : method create(java.io.InputStream)
location : class java.util.Scanner
Scanner stdin = Scanner.create(System.in);
^
And the line it has a problem with:
Scanner stdin = Scanner.create(System.in);
I would appreciate any help.

impot java.util.*;
public class BMICalculator {
public static void main(String[]args) {
final double KILOGRAMS_PER_POUND = 0.454;
final double METERS_PER_FOOT = 0.3046;
System.out.println("BMI Calculator\n");
//Line it has a problem with
Scanner stdin = Scanner.create(System.in);
System.out.print("Enterweight (lbs): ");
double weight = stdin.nextDouble();
System.out.print("Enter height (feet); );
double height = stdin.nextDouble();
double metricWeight= weight * KILOGRAMS_PER_POUND;
double metricHeight = height * METERS_PER_FOOT;
double bmi = metricWeight / (metricHeight * metricHeight);
System.out.println("A person with");
System.out.println(" weight " + witght + " (lbs) ");
System.out.println(" height " + height + " (feet) ");
System.out.println("has a BMI of " + Math.round(bmi));
}

Similar Messages

  • I had a problem with the hard disk on a 2010 macbook pro. Replaced the hard disk with an Hitachi 1TB and when I tried to erase and format It fails with input/output error. Any help much appreciated!

    I had a problem with the hard disk on a 13" 2010 macbook pro. Replaced the hard disk with an Hitachi 1TB disk but when I tried to erase and format, it fails with input/output error and at other times saying unable to allocate memory. Any help much appreciated!

    Zap the PRAM and Reset the SMC, then try again.

  • Disk Utility: Create image fails with input/output error

    Starting to create an image and saving it into an external hard drive (MacOS extended Journaled).
    It starts after less than 60 secs it comes out with an error : Failed to create the image (input/output error)

    If you don't mind I'd like to discourage you from backing up a drive onto a disc image file no matter where you plan to save it. Disc image files can be very problematical when it comes to trying to restore the backup. Furthermore, you cannot boot from a disc image. If the disc image file becomes corrupted then you have no backup.
    I would like to propose that you think about a better way to backup your drive. You can clone the drive to your backup drive. It's easy to do using Disk Utility's Restore feature. A clone backup is not only bootable but you have direct access to all the files on the backup.
    In order to make a bootable clone open Disk Utility. Select Disk Utility Help from the Help menu. Search for +duplicating a disk+. Click on "Duplicating a disk" at the top of the list of articles. Follow the directions.

  • Help with Input/Output Parameter Size using OLE DB Provider

    I am using the OLE DB Provider for 9i in an Active Server Page to call a stored procedure in a 9i database. I pass have an input/output parameter (adVarChar with adSize=30) in which I pass a two digit number in, and expect to get a character value greater than 2 characters in return. However, when I execute the stored procedure call, it appears the value being returned in the parameter is being truncated to the size of the value I passed in (2 characters). Is there a way I can insure the parameter will return the entire length of the result regardless of the length of the input value?

    cmd.Parameters.Add("retstatus", OracleDbType.Varchar2, 200, ParameterDirection.InputOutput); It seems to me that you're trying to use an OracleParameter constructor with parameter name, parameter type, parameter SIZE, and parameter direction. But OracleParameter class does not have any such constructor. Therefore, your test tries to use another constructor incorrectly.
    OracleParameter has two constructors with four parameter ...
    public OracleParameter(string parameterName, OracleDbType type, object obj, ParameterDirection direction)
    public OracleParameter(string parameterName, OracleDbType type, int size, string srcColumn)
    ... and none of these matches your constructor. One way to solve this problem is to use appropriate constructor or OracleParameter properties.

  • Help with input output .txt files!

    Hi i'm a student and totally new to programming. I need the program to read a .txt file and then output it:
    import java.io.*;
    import java.util.*;
    public class Reading{
         public static void main(String[] args)throws Exception{
              Scanner scanner = new Scanner(new File(args[0]));
              while(scanner.hasNext()){
                   System.out.println(scanner.next());
              scanner.close();
    and
    import java.io.*;
    public class Writing{
         public static void main(String[] args)throws Exception{
              String outputFile = args[0];
              PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
              for(int i = 0; i < 100; i++){
                   writer.println(i * i);
              writer.close();
    How would i merge these together? I also changed the command line to java Reading Input.txt but it wont run on DrJava on my computer or laptop and i get an error? How do i then store the strings into an arraylist and iterate throught the arraylist to reverse the strings?
    Please help.

    You could do this...
    import java.io.*;
    import java.util.*;
    public class FileIO2
         public static void main(String argsp[])
              String readfile="ajr.txt";
              String writefile="ajr2.txt";
              try{
              read(readfile);
              write(writefile);
              catch(Exception e)
              {e.printStackTrace();}
         public static void read(String filename) throws Exception
              Scanner scanner = new Scanner(new File(filename));
              while(scanner.hasNext()){
                   System.out.println(scanner.next());
              scanner.close();
         public static void write(String filename) throws Exception
              String outputFile = filename;
              PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
              for(int i = 0; i < 100; i++){
                   writer.println(i * i);
              writer.close();
    }

  • Help -- backup data with disk utility, input/output error.

    My problem started when my MacBook Pro computer (with OsX) froze.  When I restarted, the startup screen stayed on for a long time.  Now, the startup screen stays on for a few seconds and then shuts off.  I do NOT have a recent backup of my data.  I have tried the following:
    Went onto the recovery partition, used Disk Utility.  When I verified the disk, it said it needed repair.  When I tried to repair the disk, it said it could not be repaired.
    I then tried to copy a disk image of the hard drive onto my external hard drive, but it says there is an "input/output error" and won't allow it.  How else can I backup files on my computer at this point?

    Had issue partitioning 2TB my passport drive, got input/output error while using disk utility.
    Here is what I did to get my external disk back
    In Disk Utility
    1) Try to use erase option first, it failed
    2) Try to partition the disk, failed as well.
    3) Then try erase option again, then ...   it worked !!

  • I'm trying to backup a my harddrive with disk utility but I'm getting an error  Unable to create Backup.dmg" (input/output error). Is there any other way to save my data? I believe my hard drive is failing or corrupt file. I can't boot up. Grey screen

    I'm trying to backup a my hard drive with disk utility but I'm getting an error  Unable to create Backup.dmg" (input/output error). Is there any other way to save my data? I believe my hard drive is failing or corrupt file. I can't boot up. Grey screen and spinning wheel. I've tried everything https://discussions.apple.com/message/20580424#20580424
    any help will be greatly appreciated.

    Check here. Also have you done a TimeMachine back up?
    http://support.apple.com/kb/TS2570

  • External Drive Disk Erase Failed with the Error Input/Output Error

    I have 2 hard drives in an external FW800 enclosure that I am unable to format. When I go to initialize the drives in Disk Utility, I get the following error message: "Disk Erase failed with the error: Input/output error."
    The drives show up in Disk Utility, but I can't repair them (that option is grayed out). Disk Utility correctly ID's the manufacturer of the drives (Maxtor), their size (200gb each), so it's obviously seeing that the drives are there. But it won't let me format them.
    The drives are new, by the way; they don't have any data/files on them. I have Disk Warrior, but the drives don't show up there to be repaired -- probably because they aren't formatted yet.
    After looking at other posts, I tried switching the jumper settings around on the drives -- from Master/Slave to cable select and back again, but it didn't help. I also tried doing a zero erase (even though the drives are new), zapping the PRAM -- again, no help.
    One question I had is whether this could be a bad FW800 cable? The cable is new -- it came with the enclosure, which is an OWC Dual FW 800 enclosure. Other than that, does anyone have any other thoughts about what's causing this? Any help would be greatly appreciated.
    Matthew

    SOLUTION!!!!
    I had the exact same problem. I have the original 20 GB hard drive that came in my Powerbook G4 550MHz and a couple of years ago I traded up for a 60 GB drive and bought a FW/USB enclosure for my original drive to use it to backup my important files. I hadn't backed up in over a year (shame on me!) and I decided maybe I should erase the drive and start from scratch. It was connected via USB.
    At that point DiskUtility gave me the exact same Input/Output error. I tried partitioning the drive into 1 or more partitions but came up with the same error. I couldn't figure out what was wrong so I decided to startup in OS 9.2.2, I did that and let it start up, then plugged in the hard drive and it gave me the standard "This disk is unrecognizable, do you want to eject or erase?" so I clicked Initalize. It worked!
    Just make sure you choose the MacOS Extended option when initializing out of OS 9 (instead of the MacOS Standard option) so it can be read and viewed in OS X.
    If your computer is too new to be able to boot from an OS 9 folder on your drive or an OS 9 CD, then see if a friend or a local library has older computers that are running OS 9 or can boot from it. If not let me know and you can send me your drive and I'll reformat it.
    Kind of crazy...I haven't used the OS 9 partition on my HD in YEARS...was even thinking about erasing it since I don't use any Classic applications anymore...good thing I didn't!
    Nick
    Powerbook G4 550Mhz   Mac OS X (10.4.6)  

  • Failed to execute default file manager (input/output error) After Firefox Reset? [Any more help? you guys/gals rule!]

    after resetting firefox it seems I cant open anything from the menu as i get the above error msg.

    Are you using ubuntu? [http://askubuntu.com/questions/42682/failed-to-execute-default-file-manager-input-output-error]

  • Pairing Garmin with BT: Can't create connection: Input/output error

    I'm learning how to use BT in linux.  I have a Garmin and a CE device that has bluetooth capability.  Both are in discovery mode.
    Running "hcitool cc [macaddr]" to pair the Garmin looks promising, the Garmin receives the, well, transaction (what's this called?), and says the passkey is 1234.  However, I press OK on the Garmin, and it shows a second message that the connection failed.  Looking at my PC, I see this in the terminal:
    Can't create connection: Input/output error
    What am I doing wrong?

    Check here. Also have you done a TimeMachine back up?
    http://support.apple.com/kb/TS2570

  • External Hard Drive Input/Output error

    I recently started having problems with an external hard drive setup that I did not have problems with prior to upgrading to 10.5.5 and trying to setup the drive to be compatible with Time Machine.
    The hard drive enclosure that I have has 2 bays for two SATA drives. I have used this enclosure without any problems until I tried to get 1 drive to act as the backup drive for Time Machine and the other to be storage. I formatted them using Drive Genius. I used the option for GUILD or GUIL which it said was the better format for using with Time Machine.
    The first problem I ran into since upgrading and reformatting the drives is I got an "input/output" error the first couple times I connected the drive via USB to my Mac. I could still use the drives but I got weird errors every once in a while like "input/output error" or "device was not ejected properly" even though the device had not been unplugged.
    Now the drives will not mount using OS 10.5.5. The drives show up when I open Disk Utility, but I cannot get them to mount. I have ran Disk Utility First Aid, and it says the drives are fine. There is one error that shows up when I run the "Repair Disk" feature. It reads "Invalid content in Journal". But Disk Utility also says "The volume was repaired successfully".
    I have seen some posts when I do a search in google about this issue and it seems this is a known issue. Every suggestion I see says to insert your Tiger DVD and reformat the drive using that and the problem will be solved. The only problem with that is I have a lot of important files on the drive that I cannot lose. I had the files backed up until I moved them to the new drive a while back. Now I do not have a backup because I was in the process of switching to bigger drives and erased the old drives after doing so because everything was working fine.
    I am hoping someone out there may have some suggestions (other than erasing the drive) to get my dives to mount so I can transfer the data off to another drive and reformat after.
    Thanks,
    Paul Rugg

    Thanks for the suggestion.
    Do you think that would work better than Drive Genius? I bought Drive Genius 2 and it does not even see the drives when they are plugged in unlike Disc Utility which can see the drives but cannot mount either one.
    Maybe this following post I made to a different questions may help. The data on the drive is other buying another program for if it will work. I think my next step may be to go over to a friends place and try to mount the drives on his computer and transfer stuff off if they connect.
    text below posted to other question relating to external hard drive problem.
    I have recently had the same mounting issue with my new external hard drive. I just purchased a new 750Gb Western Digital Sata drive and got everything transfered over to it. Immediately, I got an error saying that the drive had been ejected incorrectly even though it was still plugged in. I was a little curious. I restarted the computer (hard drive still plugged in via USB 2.0) and the drive showed up just fine. I plugged another 250Gb drive into the same case (2 bays) and the 250GB drive showed up just fine.
    Well, I then noticed there was an OS upgrade available when I ran Software update so i ran it and when I rebooted the drives were gone. I can see the drives in Disc Utility, but they will not mount. Drive Genius cannot see either disc. Disc Utility says I need to repair the drives, but when I do it says they are fixed but they don not mount.
    The problem really seems to be related to mounting USB external drives. I got ahold of 2 seperate external firewire hard drives and one shows up just fine while the other has the same problem (both work on other systems. I would try wiping the drives and reformatting but ALL MY stuff is on them and not everything has been backed up. Yuck! I have not tried connecting my hard drive to another Mac yet.
    The drives being used are #1 Maxtor Maxline Plus II 250GB SATA/150 HDD 1.5b/s 7Y250m00654ra
    and #2 Western Digital WD7500AACS WD Caviar GP Green Power drive.
    I have another post similar to this and I have not received any feedback, but I have been doing my own searching and have found similar posts on the net.
    Anybody have any clue what might be going on here? It really seems to be related to my upgrade.

  • External Hard Drive not Readable & Input/Output Error?

    I was using my OWC 300gb external hard drive for a while and it's worked great. I had a bunch of files on it, but I recently transferred everything to another external HD I have, which worked fine, so I could erase this 300gb one. I can't remember what happened, but somehow my Macbook doesn't recognize this hard drive. I think erased everything and then unplugged it without ejecting it first. Anyways, nothing is on the the drive anymore and I get this error message:
    "The disk you inserted was not readable by your computer"
    This pops up when I restart my Macbook. When I try to use Disk Utility, it greys everything out on the partition and Disk Repair tabs. On the 'Erase' tab, it will allow me to select Erase, but then gives me the error:
    "Input/Output error"
    Does anyone know how to get my Macbook to see my drive (so I can start to partition it)? For some reason only Disk Utility acknowledges it's there, Finder won't.
    Anyone have any tips of what it is or what I can try? I did try to use my OS discs booting up holding C, but that doesn't work either.

    Hi there. Everyone is saying on these forums that the hard drive is failing...suck. I went and bought a new when I got input/output error and found that the new one showed the same input output error, making it impossible to partition the disk. Then the guy in the apple service center told me the new one was bad too, after having seen the code that came up related to my new scorpio 250 GB drive. Instead of sending it back, I took it out and installed the old one..however this time with a slihtly more of pressure on the tape holding down the hard drive cable between the hard drive and the circuit board. Amazingly, this time it didn't even show any hard drive at all! Then I understood what was wrong. It was exactly what was indicated an "input/output errror"! ..the cable was broken. I bought a new cable, well the Powerbookmedic sold it as new but it was an old working one that arrived. Immediately, after change of cable the old hard drive and now also the new 250 GB works perfectly! I remember that some interesting symptoms prior to all hard drive problems appeared, such as not being able to start up properly, strange blue screens, flipping question marks etc. I remember that shaking the comp occasionally worked to get it going. No wonder, shaking occasionally made it work and i believe the damaged cable maybe changed position and started conducting. The cable is very sensitive and probably should not be taped down so hard as the first service center guy at apple had done with mine when he fixed it the comp a few years ago. Polymers/plastics bent heavily become fragile/brittle with time and are specially sensitive under pressure/bent. Note that my old damaged cable still conducted and showed the hard drives but didn't work fully. I hope this will help someone, it took me 2 month to figure out..

  • WD External Hard Drive will not format, "Input/Output Error"

    Trying to reformat an old Western Digital external drive, immediate error in Disk Utility "Input/Output Error". Switched USB cords/ports, nothing. Just getting a second opinion before I trash it.
    I know I can probably take out the drive and put it in an external case, but this was just going to be an extra drive for a friend, not worth the $20 for the case.
    Thanks

    I'm getting the same errors from both my USB ports when I try to format a brand new Maxtor 1TB drive.
    I had noticed some strange errors a week ago when Time Machine was reporting an error saying it had failed (this was using a nother external firewire drive). Errors were (not verbatim) "error writing files" & "unknown error".
    I naturally thought there was a prob with the ext drive, so knowing that I had at least a good full back-up on there, bought a new ext drive (larger) to perform a full backup on so I could reformat the firewire drive and utilise it elsewhere - but got errors when I tried to set it up as a Time Machine drive seconds after I took it out of the box.
    I ran "Verify Disk" on my internal macbook HD and it reported some permission errors and mis-reported file sizes and told me to "Repair Disk". I did, and this stated it fixed a few things. Ran Verify again and it still reported some permission errors.
    Now, this leaves me in a sticky spot. I can't format the maxtor external disk in order to manually copy over my disk content, it doesn't even show up in disk Utility or in Finder. I can't perform a Time Machine backup - as it can't see the maxtor disk. I can't do a TM backup on the old Firewire disk - due to the program errors. AND it appears I have permission errors on my internal HD.
    Whatever course of action I take to correct these problems - I would like the knowledge that I have a full backup to restore from if things "head south" while I look to correct the HD permission issues.
    Anyone out there with some REAL SMART ideas that can help me out here ?
    Right now I'll even accept "Half Smart", "Clever" and "**** - Why Didn't I Think Of That" answers !
    S.

  • Restoring .dmg image from external to Mac HD in Disk Utility: "Unable to scan image (Input/output error)"

    Hi guys,
    So I've got a problem with restoring the image backup I did (using Disk Utility) of my 500GB HD on my MBP which was acting weird or maybe even crashed a few months ago. After creating the backup image and putting it on my external device, I installed Mavericks back to see if everything was alright (mainly the HD) and everything seems okay.
    I did try restoring the backup image through disk utility before installing mavericks (thus erasing everything again on the HD) AND after. But nothing..
    The whole process starts fine and then it starts scanning the image when after maybe a good 10-15min in I get a message that says that it was unable to scan the image. I tried verifying the disk(s), everything came out "OK". Also tried scanning it through Images > Scan image for Restore... with the same results.
    While searching I've seen people getting messages like "Unable to scan filename.dmg (Invalid argument)" and "Unable to scan filename.dmg
    (Internal error)" but none have (Input/output error)
    The screen grab is below.
    I also came across something about using terminal/commands but I'm not that savvy with it, especially considering that those there had issues with either mounting or trouble finding the image.
    I've also tried moving the backup image to a different external device 2TB and also the desktop because I read it may have to do with the format of the externals or maybe free space. But THEN I would get a message saying
    "The Finder can't complete the operation because some data in "Mac HD Backup.dmg" can't be read or written. Error code -36"
    Fyi ALL my externals are HFS+/Journaled and the backup image format was compressed.
    I REALLY don't know what to do next. Was it the wrong move to create a dmg image? Have I lost everything? Is there still a way out?
    If anyone can help, THANKS!
    2012 MacBook Pro, Mac OS X (10.9.3)

    Make a "Genius" appointment at an Apple Store, or go to another authorized service provider. You may have to leave the machine there for several days.
    Back up all data on the internal drive(s) before you hand over your computer to anyone. There are ways to back up a computer that isn't fully functional—ask if you need guidance.
    If privacy is a concern, erase the data partition(s) with the option to write zeros* (do this only if you have at least two complete, independent backups, and you know how to restore to an empty drive from any of them.) Don’t erase the recovery partition, if present.
    Keeping your confidential data secure during hardware repair
    Apple also recommends that you deauthorize a device in the iTunes Store before having it serviced.
    *An SSD doesn't need to be zeroed.

  • Disk utility 'input/output error' message?

    I am "creating an image" of a DVD using disk utility (prior to making a copy on a blank DVD disk).   Why am I now rec'ing an 'input/output error' message?   I have already copied several other DVDs from the same author (with her permission, they are not copywrited.) w/o a problem.
    What's going on?  original damaged? an incorrect step on my part?  some sort of space problem?  ( I have tons of room on my iMac.)
    Thanks for your help.

    Take a look at Cinematize 2, I've used it with iMovie 06 and iDVD 08. It has several modes of converting the data. One mode is called "lossless".
    For the job you're doing you may prefer to use iMovie 06 instead of iMovie 08 (I would).
    iMovie 06 and iDVD 08 is a terrific combination.
    Your workflow would go something like this.
    Use Cinematize 2 to create a Quicktime file from the DVD.
    http://www.miraizon.com/products/products.html
    Important that file into iMovie 06.
    From iMovie 06, share to iDVD 08 (assuming you want a DVD).

Maybe you are looking for