Can someone please help?

I am a student doing the Bachelor of Education at CSU, via the Accelerated Teacher Training Program, by distance ed. My area is Computing and IT, and as part of my course I have to do a basic Java subject. (ITC129 - if that means anything to you).
I have attended the residental school, but did'nt find it very helpful, and now I am trying to compose what should be a very simple piece of code for an assignment.
Im finding it VERY frustrating, because I seem to be be missing a very basic piece of understanding.
this is the question...
In a particular mobile plan, local calls between 700 hours and 1900 hours are charged at $0.60 per minute. Long distance calls (to places over 100km away) during these hours are charged at $1.10 a minute. At other times calls are charged at half the normal rate.
A program is required which calculates the total cost of a arbitrary number of calls. for each call, the user enters a time value (in 24 hour format), a distance (in Kms) and a call length (in minutes). The program then displays the cost of that call and also adds the cost onto a cumulative total.
When the user has no more to process, they enter a value of -999 instead of a legal time. when the program reads this sentinel value it displays the total cost of all the calls and ends.
would one of you clever people please look at what I have (incomplete, obviously) so far, and tell me what I'm doing wrong? I feel like such an idiot....
class Assignment2
{// begin class
     public static final
     void main(String[]argv)
     {// begin main
          KeyboardReader kb=new KeyboardReader();
          double charge, newCharge, totalCharge;
          int callTime, dist, dur;
          System.out.println("\n\t\tTo exit, enter a time value of -999 ");
          System.out.print("\n\t\tPlease enter the time the call was made ");
          System.out.print("\n\t\t(in 24 hour format). ");
          callTime=kb.getInt();
          System.out.print("\n\t\tPlease enter the distance from point to point ");
          System.out.print("\n\t\tof the call (in Kms). ");
          dist=kb.getInt();
          System.out.print("\n\t\tPlease enter the duration of the call");
          System.out.print("\n\t\t(in minutes). ");
          dur=kb.getInt();
          errorCheck();
          writeData();
          calcCost();
          totalCharge();
          }//end main
     static
     void writeData()
          System.out.println("\n\t\tThe time of the call was "+callTime+" hours.");
          System.out.println("\n\t\tThe distance of the call was "+dist+" Kms.");
          System.out.println("\n\t\tThe duration of the call was "+dur+" minutes.");
     static
     void errorCheck()
          if (callTime>2400)
               System.out.print("Sorry, but there are only 24 hours in a day,/n/n/tPlease try again.");
          if (callTime==(int)'-999')
               System.exit(0); //ends the program - worked in Assignment 1, for some reason it dosn't like this line now.
          if (callTime<=0)
               System.out.print("Sorry, can't have negative hours./n/n/tPlease try again.");     
     static
     void calcCost()
          if ((callTime>=1700)&&(callTime<=1900))
               newCharge=(callTime*(dur*.06));
          if (dist>=100)
               newCharge=(callTime*(dur*1.1));
          else
               newCharge=(callTime*(dur*0.55));     
          totalCharge=(totalCharge+newCharge);     
     static
     void totalCharge()     
          System.out.println("\n\t\tThe cost of your call is "+totalCharge+".");     
}// end class
Thank you so much for perservering with this question...
Cathy

class Assignment2 {
     static double charge, newCharge, totalCharge;
     static int callTime, dist, dur;
     public static final void main(String[]argv) {
          KeyboardReader kb=new KeyboardReader();
          System.out.println("\n\t\tTo exit, enter a time value of -999 ");
          System.out.print("\n\t\tPlease enter the time the call was made ");
          System.out.print("\n\t\t(in 24 hour format). ");
          callTime=kb.getInt();
          System.out.print("\n\t\tPlease enter the distance from point to point ");
          System.out.print("\n\t\tof the call (in Kms). ");
          dist=kb.getInt();
          System.out.print("\n\t\tPlease enter the duration of the call");
          System.out.print("\n\t\t(in minutes). ");
          dur=kb.getInt();
          errorCheck();
          writeData();
          calcCost();
          totalCharge();
     static void writeData() {
          System.out.println("\n\t\tThe time of the call was "+callTime+" hours.");
          System.out.println("\n\t\tThe distance of the call was "+dist+" Kms.");
          System.out.println("\n\t\tThe duration of the call was "+dur+" minutes.");
     static void errorCheck() {
          if (callTime>2400)
          System.out.print("Sorry, but there are only 24 hours in a day,/n/n/tPlease try again.");
          if (callTime==Integer.parseInt("-999"))
          System.exit(0); //ends the program - worked in Assignment 1, for some reason it dosn't like this line now.
          if (callTime<=0)
          System.out.print("Sorry, can't have negative hours./n/n/tPlease try again.");
     static void calcCost() {
          if ((callTime>=1700)&&(callTime<=1900))
          newCharge=(callTime*(dur*.06));
          if (dist>=100)
          newCharge=(callTime*(dur*1.1));
          else
          newCharge=(callTime*(dur*0.55));
          totalCharge=(totalCharge+newCharge);
     static void totalCharge() {
          System.out.println("\n\t\tThe cost of your call is "+totalCharge+".");
}Try this and get an idea!
xH4x0r

Similar Messages

  • I tried updating my iPod 5th gen to iOS 8 but it only shows me a picture of the iTunes logo and a charger at the bottom, I'm not sure what this means or what I need to do. Can someone please help me?

    I tried updating my iPod 5th gen to iOS 8 but it only shows me a picture of the iTunes logo and a charger at the bottom, I'm not sure what this means or what I need to do. Can someone please help me?

    After restoring to factory settings/new iPod you will then have to restore from backup
    To restore from backup see:
    iOS: Back up and restore your iOS device with iCloud or iTunes       
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:                         
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        

  • My iPhone 4 will not sync my new voice memos from the "Voice Memos" app to my computer. This is frustrating, should not be so hard, can someone please help. I use PC with windows 7 with iPhone version 6.1.3 and iTunes most recent. Thanks.

    My iPhone 4 will not sync my new voice memos from the "Voice Memos" app to my computer. This is frustrating, should not be so hard, can someone please help. I use PC with windows 7 with iPhone version 6.1.3 and iTunes most recent. Thanks.

    In the Music tab of iTunes, do you have 'Include Voice Memos' checked?

  • My MacBook Pro iTunes movie purchase is not showing in iTunes store movie purchases nor does it show on my iPad or Apple TV.  Can someone please help me with a solution?  Thanks.

      First of all, I live in Ho Chi Minh City, Vietnam. Sometimes, I use a VPN to search on the web here. I purchased Toy Story 3 on my MacBook Pro 2011 OS/X - Lion through iTunes.  I initially had trouble downloading it which may be due to being on and off the VPN but after a while it finally downloaded and shows up in my iTunes library on my MacBook. 
      Under my Apple ID account (which is the only Apple ID account I have), I look under purchase history and it shows that I paid for Toy Story which is where I got my Order # from.  But if you go to the iTunes Store then to the Quick Links then click on Purchased, under all my Movies, it does NOT show Toy Story 3 as one of my movies.
      Now when I go to my iPad (3rd gen.), Toy Story 3 does not show up under purchased movies (all or not on my iPad).  It does not show up on my Apple TV as well.  If I want to have Toy Story 3 on my iPad or Apple TV, then it says I have to purchase it again.
      I have searched for help via Apple support communities but so far none of their solutions have worked for me.  I have tried logging off iTunes & App Store on iPad and also shutting down the iPad.  I also made sure that under iTunes Preferences>Store that iTunes in the Clouds purchases is checked. Can someone please help me with this?  Your consideration is greatly appreciated.  Thanks.

    Thanks King_Penguin for taking time to read and reply. 
    I just purchased this movie on Thursday, May 15, so just a few days ago.  I have never had any trouble whatsoever since I have been in Vietnam.  I have downloaded several movies and even music and they have all synced to my respected Apple products except for this purchase. 
    Sorry, I don't quite understand what you mean by studios and different versions.  Could you please explain? 
    I checked my purchased list in my purchase history under my account and there are no hidden items. 

  • HT4623 hi... can someone please help me.. i want to download the latest ios, but do not have the software update option in the general settings....

    hi... can someone please help me.. i want to download the latest ios, but do not have the software update option in the general settings....

    Connect it to iTunes on a computer and update it from there.
    (73609)

  • Updated my iphone4 with ios6.1 software. App store is not working. Tried rebooting, restoring, changing date, signing with another apple id etc. but no luck. can someone please help?

    Updated my iphone4 with ios6.1 software. App store is not working. Tried rebooting, restoring, changing date, signing with another apple id etc. but no luck. can someone please help?

    I guess I will wrap this up. I have abandoned iPhoto and viewing my Photo Streams using it and moved to Adobe products (Bridge + PS). So that's that.

  • Can someone please help me re-install my Creative Design 5.5 on my Mac?  My MacBook Pro recently crashed and had to have the hard drive replaced.  The back up from Time Machine is not reinstalling the program.  Since I have the download paid, and codes, I

    Can someone please help me re-install my Creative Design 5.5 on my Mac?  My MacBook Pro recently crashed and had to have the hard drive replaced.  The back up from Time Machine is not reinstalling the program.  Since I have the download paid, and codes, I need direction on how to reinstall -- HELP?

    Hi bodegakc,
    If you have the serial number then please use the below mentioned link to download the product you are looking for .
    CS5.5
    Also before installing Please go to Applications-->Utilities--> Adobe installers and if there is any uninstaller for CS5.5 , you can remove it and do a fresh install.
    You can also use creative cloud cleaner tool before installing.
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    Thanks
    Nikhil Gupta

  • I keep getting an error can someone please help

    i am trying to develop a web application using tomcat. i have a servlet that will not compile because of two things. firstly, it says that package beans does not exist and secondle it gives an error becuase im using a user bean here to set some attributes but it keeps saying it cannot resolve symbol User. can someone please help me sort this out. thanks

    You need to package the bean classes in the proper package (in your case beans), and then place them in WEB-INF/classes/<package dirs>.
    Then you need to import the classes in the JSP.
    Cheers!
    ***Annie***

  • HT201412 can someone please help me out of nowhere my iphone went fuzzy then completely turned off i have tried charging it and it still wont work and itunes wont pick it up and it wont start up nothing please help me

    can someone please help me as its not letting me turn it on. i have tried to start it up pressing both buttons connecting to itunes and its not working still., it wont even charge or show apple icon anymore,

    You may not get a response as you are shouting at everyone.
    All caps indicates shouting, is considered rude, and is difficult to read.
    Many will not read such posts.
    Try turning off you caps lock and asking again.

  • My iphone 4 won't connect to my mac. It says that I need to install the lastest version of itune (11.1) but when I try to update itunes it says that I have the current version 10.6.3. Can someone please help!

    Hi,
    My iphone 4 won't connect to my mac book, it says that I need to install to latest version of itunes 11.1. When I go to itunes and try to update, it says that I have the latest version (10.6.3). Can someone please help me!
    thanks

    You are probably running OS 10.4 or 10.5 on a PPC Mac.  No version of  iTunes higher than 10.6.3 is available for these older Macs.  I have the same problem, and while I can still use the PPC to sync my iPod, it can't be used to sync an iPhone 4 or higher.  The only solution, as I discovered after upgrading to the iPhone 4, is to buy a newer Mac.  I was able to get a 2006 MacBook running Lion for under $300, and that has been a lifesaver.

  • My safari keeps closing unexpectedly and when it does it tells me that it quite while using the .GameHouseBeachParty.so plugin. I have no idea what this means! Can someone please help me fix this?

    My safari keeps closing unexpectedly and when it does it tells me that it quite while using the .GameHouseBeachParty.so plugin. I have no idea what this means! Can someone please help me fix this?

    You have the Flashback trojan.
    Check out the replies in this thread for what to do;
    https://discussions.apple.com/message/18114958#18114958

  • Please help me! I imported my pics to iphoto but I can't open them now. I can't see them on full Screen/edit them like before. All I get is a exclamation mark when I double click on them. I don't have copies, can someone please help me?

    I imported all my pics to Iphoto and I can't open/edit them now. When I double click on them, I only get an exclamation mark. Please help me I don't have copies. I tried burning them to a cd but it didn't work. Can someone please help me?

    The ! turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents.
    What version of iPhoto? Assuming 09 or later...
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • I'm trying to transfer the music from my iPhone 3G to my iPod shuffle but I don't know how. I checked on websites but i dont really trust them cause I don't want all my music to be erased (cause i spent a lot of money on them) can someone PLEASE help me.

    'm trying to transfer the music from my iPhone 3G to my iPod shuffle using iTunes but I don't know how. I checked on websites but i dont really trust them cause I don't want all my music to be erased (cause i spent a lot of money on them) can someone PLEASE help me. Why is iTunes so complicated.

    iTunes match - http://www.apple.com/itunes/itunes-match/ - see FAQ at end too
    http://arstechnica.com/apple/2011/11/itunes-match-your-questions-answered/
    http://ipod.about.com/od/UsingiOS5/a/Itunes-Match-Frequently-Asked-Questions.htm
    http://forums.macrumors.com/showthread.php?t=1277415 - deleting items from your computer but saving them in iCloud.  Yes, but risky.

  • Can someone please help me?  I am having trouble activating my iPhone.

    I attach my iPhone to my computer through the USB and the cradle. iTunes opens fine and it shows my iPhone. When the iPhone window opens I get the following error. We could not complete your iTunes store request. The network connection timed out. Make sure your network settings are correct and your network is active , then try again. Can someone please help me with thin. I have tried to contact apple support but havn't been able to get anyone. If you go to my profile and read my bio there is a link to a site where I sell my concert photographs. My site is www.davextreme.photoreflect.com or my myspace is www.myspace.com/davextreme1. I would be willing to send an 8X10 of any musician you want to anyone who helps me solve this problem.

    "The network connection timed out. Make sure your network settings are correct and your network is active , then try again."
    This is usually the type of message you get when you have NO internet connection. It can also happen if the site that you are trying to contact is experiencing troubles or is just to busy at the time. Are you sure your connection is working properly?

  • After downloading ios 7.2 my iPad mini seems to have a mind of its own. I'm not sure what to do to fix this problem. Can someone please help me.

    I updated my iPad mini to ios 7.0.2 couple days ago. Everything was fine until yesterday. I noticed that it seemed to have a mind of its own. It kept opening and closing app. I'm not sure what to don to fix this problem. I've tried restoring my iPad mini but that didn't help. Can someone please help me?

    Try This...
    Close All Open Apps... Sign Out of your Account... Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...
    If no joy...
    Reset all settings
    Settings > General > Reset > Reset all Settings.
    This will return all iDevice settings to factory defaults... you will not lose any data.... But you will have to re-enter all of the device settings.
    If the issue persists...
    Connect to iTunes on the computer you usually Sync with and Restore
    http://support.apple.com/kb/HT1414
    Make sure you have the Latest Version of iTunes (v11) Installed on your computer
    iTunes free download from www.itunes.com/download

  • My Iphone 5 has gone blank, I can not see anything. Restore with itunes has not worked either. Can someone please help?

    Hi I recently upgraed to iOS 6.1 on my Iphone 5. After the upgrade, it was all good. Over the weekend I went Austria for Ski. While taking the photos, I simply locked the phone and kept it my pocket as I had to go. After sometime when I opened my phone, I could hardly see anything. I tried to unlock with pin and tried restarting with great difficulty. But nothing worked. Coming back home today, I have tried restore the software and still no luck. I have tried restore almost 5 to 6 times, but the screen is still blank. I dont know if what state it is in and I can not do anything to fix it. I am very annoyed with the support service as they can not be reached on Sunday evening.
    I could manage to book a call tomorrow but I have lot of work over next few days at work. Can someone please help how to fix this issue now? Any suggestions will be much apperciated.
    Thanks,
    Srini

    srinifromlondon wrote:
    ...  Any suggestions will be much apperciated...
    Try this Discussion
    https://discussions.apple.com/message/19521062

Maybe you are looking for

  • Display does not work mac pro

    I tried connected 4 27" LG 1080p monitors to the mac pro (Late 2013), only two come on at a time no matter what ports i use. All the monitors have come on at least once but not all at the same time. Is there something I need to do? Also under system

  • Advantages of using labview in embedded application when compared to c ?

    Hello all, I am looking to develop embedded application with help of labview programming Started with Lm3s8962 evaluation board. So i would like to know 1 Advantages of using labview in embedded application when compared to c ? 2 Can we deploy the co

  • Duplicating a user to another in the same db

    I have read plenty of posts about this, but no matter how I try with datapump or simply exp/imp I cant seem to get this right. I a devel 11gR2 server with one database and a user, USERA that an application uses. I need to duplicate that application s

  • Can i use any DB with director?

    i'd like to know if i can use any DB with director, such as FileMaker (the cd program i have to make will run in pc and mac). if not, is there any solution to use DB in director for pc and mac? please response as earlier as possible, its very urgent.

  • Already bought quicktime pro but still running without the pro options

    Hello. I have already bought quicktime pro but after I had to reinstall it is running again without the pro options. I logged into apple.com and there is nowhere where I can find my actualisation or key code which I have paid for to make it run as pr