I can't seem to figure out what I am doing wrong any suggestions?

I will admit right off that I am a newb. I have done some programming with C++ but I have just started with JAVA.
here is the problem. I am writing a program for a course I am in and I have it basically put together but no matter what I do I cant seem to figure out the correct input command to retrieve keystrokes.
I will post the source code and then the error from netbeans 4.1 debug report:
package assignment_one;
import java.io.*;
import java.util.*;
/* @author Justin Jackson
* a program to calculate total gross earnings
* for one week*/
public class Main {
public Main() {
public static void main(String[] args) {
InputStreamReader charReader = new
InputStreamReader(System.in);
BufferedReader keyboard=new
BufferedReader(charReader);
int i; //test to see if loop or end
int iBasePay; //base pay rate
int iTotRegHr; //total hours up to 40
int iTotOtHr; //total hours over 40
float fTotPay; //total pay
float fOtRate; //calculated overtime rate
System.out.println("To calculate a paycheck, please press 1");
System.out.println("To exit, please press 2");
i = keyboard.read();
if (i == 1){
System.out.println("Please enter the base pay: ");
iBasePay = keyboard.read();
System.out.println("Thank you.");
System.out.println("Please enter the total hours up to 40: ");
iTotRegHr =keyboard.read();
System.out.println("Thank you.");
System.out.println("Please enter any hours over 40: ");
iTotOtHr = keyboard.read();
System.out.println("Thank you.");
fOtRate = (iBasePay * 1.5f);
fTotPay = (iBasePay * iTotRegHr) + (iTotOtHr * fOtRate);
System.out.print("The total wage is: " + fTotPay);
if (i == 2){
System.out.println("Thank you for using this program ... Goodbye.");
else {
System.out.println("I am sorry, that is not a valid option");
error report:
init:
deps-jar:
Compiling 1 source file to /home/justin/Assignment_One/build/classes
/home/justin/Assignment_One/src/assignment_one/Main.java:32: unreported exception java.io.IOException; must be caught or declared to be thrown
i = keyboard.read();
/home/justin/Assignment_One/src/assignment_one/Main.java:36: unreported exception java.io.IOException; must be caught or declared to be thrown
iBasePay = keyboard.read();
/home/justin/Assignment_One/src/assignment_one/Main.java:39: unreported exception java.io.IOException; must be caught or declared to be thrown
iTotRegHr =keyboard.read();
/home/justin/Assignment_One/src/assignment_one/Main.java:42: unreported exception java.io.IOException; must be caught or declared to be thrown
iTotOtHr = keyboard.read();
4 errors
BUILD FAILED (total time: 1 second)

Just like the message says you need to
1) Declare it to be thrown or
2) Catch java.io.IOException.
For case one add throws java.io.IOException to your main:
public static void main(String[] args) throws java.io.IOException {For case two put your code inside of
public static void main(String[] args) {
  try {
     //your code here
   } catch (java.io.IOException ex) {
      ex.printStackTrace();
}

Similar Messages

  • Can't figure out what I'm doing wrong

    I'm using Studio 8 in Mac OS X (10.4.6). I've got some pdfs
    uploaded to my site that are accessible through links one one of
    the pages. I had to make changes to the pdfs and resave them. I
    thought I uploaded them, but when I test the links it downloads the
    old version and I can't figure out what I'm doing wrong. Here's
    what I did.
    This may be a dumb way to do things, but I saved the new
    version and then dragged into the server file in
    user-->Library-->Application
    Support-->Macromedia-->Dreamweaver
    8-->Configuration-->ServerConnections-->unnamed
    server-->public_html (this is where all the other files are).
    When I go back into Dreamweaver and open the pdf listed in the
    Files window on the right (by control-clicking and selecting Open
    with-->Acrobat) the correct version appears. I thought maybe
    there was a delay or something, but I've waited and still the old
    version is what you get from the site.
    Is there an easier way to do this, or is something wrong
    maybe? Many thanks in advance.

    > This may be a dumb way to do things, but I saved the new
    version and then
    > dragged into the server file in
    user-->Library-->Application
    > Support-->Macromedia-->Dreamweaver
    Put the files in this Site's Local Site Folder.
    If unsure of where you've specified this to be, look in this
    site definition
    (dw menu-->Sites-->Manage or Edit Sites)
    If that path you've given above above is correct, it's
    wrong....

  • An mp3 file on my computer will not import to itunes by either the drag-and-drop or the Add File to Library method.  Can't figure out what I'm doing wrong.  My OS is Windows 7.

    I purchased an mp3 from a private website on my laptop.  The itunes library i sync ipod to is on my desktop, so i copied the mp3 onto a flash drive and then into my desktop in the Downloads folder and Desktop folder as well as the itunes music folder, 3 places.  I opened itunes on the desktop and read the instructions for importing music that's already in my computer.  Neither the drag-and-drop or the Add File to Library method works.  I've tried both ways over and over.  Cannot figure out what the problem is.  I do note that the name of the mp3 file doesn't show the .mp3 extension, it appears as simply it's title, Eating Healthy, without any extension at all.  Could the filename be the problem, or do you have any other idea what I'm doing wrong?  My OS is Windows 7, using IE9.  Thanks.
    ADDENDUM AFTER READING ANOTHER DISCUSSION HERE:  I have now tried right clicking the song in Windows Explorer and choosing Open With, clicking itunes.  The mp3 plays in itunes but does not add to the library.

    I don't have a Recently Added playlist.  However, I discovered that the file I had named Eating Healthy was given the name You Can Enjoy Eating Healthy when it copied to iTunes.  I'm guessing iTunes pulled the full name of the piece from the internet.  Upshot--the mp3 did transfer to iTunes on all 3 tries, but I was looking in my alphabetized list under E, not Y, so I didn't see it there.  Thanks for your help. 

  • [unsolved] BCache issues - Can't figure out what I'm doing wrong

    My setup is as follows:
    SSD on /dev/sda
    HDD on /dev/sdb
    I'm doing a EFI setup, so basically I need nothing more that an ESP and ROOT partition on /dev/sdb. I don't mind too much if the ESP partition is cached, but I suspect that could cause problems.
    There's really no need to cache ESP, so my approach have been to only cache the root partition:
    make-bcache -B /dev/sdb2 -C /dev/sda
    Which seem to work.
    After this everything seems to go wrong. I've tried several different approached and following the arch, gentoo and the official guide, but regardless I continually stumble.
    Following the arch guide: https://wiki.archlinux.org/index.php/Bcache I run in to trouble already at step 3.
    for i in /dev/sd*; do echo $i; echo $i > /sys/fs/bcache/register_quiet; done
    But as I understand it, the fact that I can't write to register_quiet just mean that I don't need to. Well, that doesn't sound very sensible.
    Apparently I can skip step 4., but even so I've tried different approaches as I said. However, no matter what I do, I end up missing /dev/bcache0, /sys/block/bcache0 or something similar, thus preventing me from continuing.
    At this point I have no other options than to ask a few question here, and maybe get some advice.
    1. In the case described, does sdb need to become backing device, or is it sensible to only make sdb2 (root) the backing device? [probably solved]
    2. Assuming that sdb need to become the backing device, will EFI boot even be possible? [solved]
    3. is btrfs a necessity, or is any file system in theory viable? [Suspect I don't need to use btrfs]
    4. Whatever questions you may think I've left out. [still have issues]
    Thanks and best regards.
    Last edited by zacariaz (2013-08-19 15:15:12)

    Just a small update.
    I think I did it mostly right on the last try, however, I couldn't boot:
    Attempting to register /dev/sda with bcache
    ash: write error: Invalid argument
    Attempting to register /dev/sdb with bcache
    ash: write error: Invalid argument
    Attempting to register /dev/sdb1 with bcache
    ash: write error: Invalid argument
    Attempting to register /dev/sdb2 with bcache
    ash: write error: Invalid argument
    Waiting 10 seconds for device /dev/bcache0 ...
    ERROR: device '/dev/bcache0' not found. Skipping fsck
    ERROR: Unable to find root device '/dev/bcache0'.
    The only thing that comes to mind it that I made two boot entries with gummiboot, as I wasn't sure if I should define sdb2 or bcache0 as the root partition, but if that was the issue, I should at least get a boot menu I would think.
    So that's how it is right now. I haven't got a clue what might be wrong.
    Best regards.

  • Question:  I can't figure out what I'm doing wrong and would so appreciate help.

    I really need help! I took on a project to produce free of charge an online publication for a non-profit nature club as they could not get anyone else. My background is in communications but not at the design or layout level. I bought InDesign and a how-to book and the first issue turned out quite well. However, I have run into a problem with this second issue that I can't get past and it has to do with the cover. I have a colour that works perfectly with the seasonal masthead and the cover photo and I want to apply it as the background for the cover page. I want the text box with the highlights of what's in the issue to appear on top of this background. I have tried two different ways to make this happen.
    1. I made a text box to cover the entire space and applied the colour swatch. I already had the cover photo in place. Then I tried to add a text box so I could list the highlights. I couldn't type in it.
    2. I went back to scratch and  created the text box with the highlights. However, I don't see any way of applying the colour as the background  below the masthead.
    I have no idea how I got this to work with the first issue that I did in the spring, as you'll see from the second image attached.
    Does this have to do with layers?
    Thanks,
    Karen

    Thanks, Peter and tman69. I'm not quite there yet. The background colour is now in place and my image appears as it should be. However, something has happened to my text boxes. It looks like the text has disappeared, but when I extend the boxes, I see the words are pushed way below. How do I bring them back up? They still remain down at the bottom when I try extending the boxes.
    K

  • I am having trouble connecting to the itunes store. i am connected to the computer and all the necessary information has been downloaded. i can't figure out what i am doing wrong or not doing

    i am having problems with my ipod touch connecting to itunes. i have downloaded and still it says Cannot connect to iTunes Store.

    - Try a reset. Nothing is lost.
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears
    - Go to Settings>Store and sign out of the account and then sign back in.
    - Can't connect to the iTunes Store

  • Lord and baby Jeebus, I can't figure out what I'm doing wrong.

    Hello friends,
    I stand before you, hat in hand, to admit to you todat that I cannot properly configure a simple home LAN. I am ashamed. I have already revoked my own man card.
    Here's the skinny:
    1. PIII HP laptop rockin' WinME
    (Pause for laughter)
    2. Dual G5 1.8 running 10.3.9
    3. Linksys Wi Fi Router
    4. Epson Photo Stylus 1280 connected via USB to the G5
    5. Both computers are members of the WORKGROUP workgroup
    There are three main problems I'm having:
    -- First and foremost my printer does not appear in My Network Places or the Add Printer Wizard on the WinME laptop (but the Mac itself does). This is crucial, as my wife needs it for her school.
    -- Second, I can access the Mac from the WinME laptop but not vice versa. Initially I was able to do it, but now I get the "Alias has been moved" error.
    -- Third: Alcohol -- even in small doses -- severely inhibits my ability to play Prince of Persia. I'm not sure that you guys could help me with this one.
    Other than that, everything's jus' peachy. Thanks a million.

    placate - To allay the anger of, especially by making concessions; appease. See Synonyms at pacify.
    I don't really follow you on "placate." I think "imprecate" may be more appropriate. In either case, I'm not blaspheming your Lord and savior. I am merely an idiot with bad judgement.
    Since I'm pleading ignorance on a help forum, I paraphrased a Homer Simpson quote to highlight my own smoldering ignorance via parallel irony. He's dumb, I'm dumb and together we form a very stupid Voltron with limited cognative capacity.
    If my rationale didn't make you comfortable, I'll go a step further and change the name of the topic. My only lament is that it may make even less sense now. See the subject line above.
    If we can that episode is behind us, than I'd still like some help with this shared printer issue. Afterward we can find some other non-Abrahamic diety to disparrage -- Zeus perhaps? I don't think I've ever had anyone complain to me about a Zeus joke.

  • I am running OS 10.5.8 along with ipoto 6. i can't seem to figure out how to upgrade. i can't upgrade to 11 but what can i do??

    i need to upgrade my iphoto on my intel based imac. running 10.5.8. can't seem to figure out how to upgrade this iphoto. i also have a new macbook on which this version of iphoto won't open. the macbook is running 10.6.7. what can i do to run iphoto on both machines??

    iLife 11 and iPhoto 9 require  OS X10.6.3 as a minimum.  So you will need to upgrade your iMac to Leopard or Snow Leopard and then purchase iPhoto 11 from the App Store.  If you can find a copy of iLife 11 somewhere you'll get all of the latest iApps.
    You're new MBP should be running iPhoto 11 and the other iLIfe 11 apps.
    OT

  • I use to drag and drop an web address into a link toolbar, can't seem to figure out how to do this...?

    I just upgraded to Windows 7 and with it I got the latest Firefox. There is nothing like learning 2 things at one time. On my old XP and 3.? all I have to do was drag and drop a web address into a link toolbar. Saving all my frequent visited or just sights I want quick access to, to a toolbar quick button. I have been playing with this for days and decided to try this Forum. I did find the Bookmark toolbar, but cant seem to figure out what is if for or if you can drop into it. When I right click it and Customize, it shows me add on buttons, but nothing to do with web addresses or alike...
    Bottom line; I want to be able to drag and drop a web address into a toolbar for recall latter and be able to edit the address with a right click at a latter date in necessary...
    Thanks, Mike

    You can drag and drop the favicon also known as the [https://support.mozilla.com/en-US/kb/Site+Identity+Button site identity button], at the left hand edge of the location bar onto a toolbar to bookmark the site.

  • I am trying to download photoshop presets from online but can't seem to figure out how to open them in photoshop. They download sucessfuly and then goes to my download folder on my computer, from there I double click on the file and photoshop opens and th

    I am trying to download photoshop presets from online but can't seem to figure out how to open them in photoshop. They download sucessfuly and then goes to my download folder on my computer, from there I double click on the file and photoshop opens and then nothing happens, any ideas? I am using a PC

    This video is a great step by step tutorial.
    Photoshop: How to Download & Install New Brushes & other Presets - YouTube
    Gene

  • The original computer I installed lightroom 3 on, has crashed.  I need to install it on my new computer and can't seem to figure out where to do that.  Please help.

    The original computer I installed lightroom 3 on, has crashed and I need to install it on my new computer.  I can't seem to figure out how to do that.  Please help?

    Lightroom - all versions
    Windows
    http://www.adobe.com/support/downloads/product.jsp?product=113&platform=Windows
    Mac
    http://www.adobe.com/support/downloads/product.jsp?product=113&platform=Macintosh

  • HT5557 Using IBook, I can't seem to figure out how to insert a blank page inbetween pages that are already set up, like if you want to add some pictures or something.  Anyone have any tips on this?  Thanks, Mark

    Using IBook, I can't seem to figure out how to insert a blank page inbetween pages that are already set up, like if you want to add some pictures or something.  Anyone have any tips on this?  Thanks, Mark

    To enable the form to be signed in Reader you will need to open the form in Acrobat; goto Advanced>Enable Usage Rights and then save this copy of the form for sending out to the users.
    The user should then be able to edit and digitally sign the form. They can then email the signed/saved pdf as a browsed for attachment or via the email icon in the toolbar. Note - if you have created an email submit button on the form, then unless they have Acrobat they could only return an xml file.
    The other way to do this however is to create a dataset by 'distributing' the form. This time the Email Return button will send back a full version of the form. During the distribution setup you will have the option to email the form directly or to save it and send it later,so you can send to users as and when or even post it to a website or intranet.
    When you receive and open the returned form it will ask whether you want to add it to the predetermined dataset (or if you want to categorise the returns into geographical areas for example, you could create new additional datasets at this point). If the form is data heavy however, the dataset will become very large and unwieldy pretty quickly, but you can export the data from it (including signatures) in xml format and import this into an Excel spreadsheet.
    To simplify the Excel xml import process I'd recommend you carefully structure your form in the hierarchy (LiveCycle) into the order you would want the data items to appear in your spreadsheet and switch off those data items that you will not need by setting the default binding for the irrelevant fields to "None".
    Clear as mud? Hope this helps.

  • I have Photoshop CS6.  I recently purchased a Nikon D750.  I can't seem to figure out how to update my version to read raw files.  I am not computer illiterate, but not a IT wiz either.  I have a pc with windows 7.

    I have Photoshop CS6.  I recently purchased a Nikon D750.  I can't seem to figure out how to update my version to read raw files.  I am not computer illiterate, but not a IT wiz either.  I have a pc with windows 7.

    Have you updated Camera Raw to 8.7?
    Camera Raw plug-in | Supported cameras
    Camera Raw plug-in installer

  • I want to download my itunes library to my shuffle. can't seem to figure out how to do this. can you help me?

    I want to download my itunes library to my shuffle. Can't seem to figure out how to do this. Can anybody help?

    You probably need to set up automatic syncing.  Select the shuffle in iTunes.  You see a row of "tabs" (buttons) starting with Summary.  Click on Music next to Summary.  This is the iPod's Music tab, where you tell iTunes how to sync songs to the shuffle.
    Check the box for Sync Music.  If your iTunes music library is small enough to fit on the shuffle, you can choose to sync Entire music library.  Then click Apply.
    Otherwise, you can choose to sync Selected playlists, artists, albums, and genres, then select (checkmark) the playlists, artists, albums, and/or genres that you want on the shuffle, from the lists below.
    Here's one convenient way to set it up.  In your iTunes library, create a new regular playlist; call it something like "iPod Songs" (or whatever you want).  From your iTunes music library, load that iPod Songs playlist with ALL the songs you want on the shuffle.  On the shuffle's Music tab, find and checkmark that iPod Songs playlist (under Playlists).  When you click Apply, those songs sync to the shuffle.  Going forward, to update songs on the shuffle, just update that iPod Songs playlist in iTunes (add and/or remove songs) and then connect your shuffle.  iTunes automatically updates the shuffle with the same changes.  If the iPod is already connected, click the Sync button to update the iPod.
    If you have any specific question, please post back.

  • Yes on my iMessage it not letting me send or  receive my message can u help me figure out what's wrong

    Yes on my iMessage it not letting me send or  receive my message can u help me figure out what's wrong

    Hello there, Marcusguerra103.
    The following Knowledge Base article offers up a number of recommendations for troubleshooting sending and receiving messages on your iOS device:
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/ts2755
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

Maybe you are looking for