Can you help me with this problem? Please!
I had just created this program that calculates the amount due from an international phone call. and I was wondering what I can do to get the program to execute when the user inputs let's say 3min and some amount of seconds. The program works when the number of minutes the call lasted is an integer, but it does not when the number of minutes the call lasted is lets say 4min30sec. Is there anyway I can get my program to execute both minutes and seconds? Help is very appreciated.
Here's the program:
import java.io.*;
import java.text.DecimalFormat;
public class PhoneCallBilling_Lab4
static BufferedReader keyboard = new
BufferedReader(new InputStreamReader(System.in));
//Named constants
static final double CONNECTION_FEE = 1.99;
static final double FIRST_THREE_MIN_FEE = 2.00;
static final double COST_OF_EACH_ADDITIONAL_MIN = 0.45;
public static void main(String[] args) throws IOException
//Variable declaration
int noOfMinCallLasted;
double amountDue;
DecimalFormat twoDigits =
new DecimalFormat("0.00");
System.out.println("This program computes an international phone call.");
System.out.print("Enter the number of minutes the call lasted: ");
noOfMinCallLasted =
Integer.parseInt(keyboard.readLine());
System.out.println();
if (noOfMinCallLasted<= 3)
amountDue = CONNECTION_FEE +
FIRST_THREE_MIN_FEE;
else
amountDue = CONNECTION_FEE +
FIRST_THREE_MIN_FEE +
(noOfMinCallLasted - 3) * COST_OF_EACH_ADDITIONAL_MIN;
System.out.println("The number of minutes the call lasted was "
+ noOfMinCallLasted);
System.out.println("Amount due = $"
+ twoDigits.format(amountDue));
}
How about converting the minutes to seconds and doing
your calulations all in seconds?ok. I am going to try that but don't you think that it would be quite cumbersome if I was to have someone actually input information. They would have to go through the entire process of trying to figure out how many minutes is in a second and all of the other problems that may occur. If I didnt have to consider all possibilities when executing this program I could leave it as is. However, I have to. And the problem states that we (as in students) have to get the user to input the number of minutes and seconds and the program has to execute.
Similar Messages
-
hello i am trying to update my phone . i am connecting it to itunes but it is giving error 3194 . can you help me resolve this problem please.
Hi ali hakim,
Welcome to the Support Communities!
The article below may be able to help you with this issue.
Click on the link to see more details and screenshots.
iOS: Restore error 3194 or 'This device isn't eligible for the requested build'
http://support.apple.com/kb/TS4451
This occurs when iTunes is unable to communicate with the update-and-restore server (gs.apple.com). This is most likely because it is being blocked, redirected, or interrupted by security software, hosts-file entries, or other third-party software.
Cheers,
- Judy -
I understand there is a way to use my Super Drive with my PC. However, it requires a System OS Disk. Which I never received. Can you help me with this?
Rick6812 wrote:
I'm using Windows 8.1.
I do not know what you mean by a Windows 8.1. Please clarify.
The Apple superdrive is designed to be used with the following Macs.
It will not work with any other Mac unless you perform this modification;
http://www.tuaw.com/2012/04/02/use-the-macbook-air-superdrive-with-any-almost-ma c/
Are you trying to get it to work with a PC?
Ciao. -
Question
I play Zuma Blitz on FB; Ever since I upgraded to Firefox 4 I can't play the game the darn frog pauses before shooting and it's a mess; you know it's what I enjoy doing and it needs to be fixed can you help me with this??? I am super frustrated ith the situationThanksUpgrading to firefox 5 and updating my plug-ins helped a bit. Frog is less 'sticky' now, but it's not solved the problem. Java needs to be up to speed or the frog goes into stasis....
-
my ipod nano 7th generation won't play anything and when i click "radio" it says to plug in headphones when they're in. Can anyone help me with this problem?
Get a flashlight and make sure there is no obstruction/dirt/debris in the Nano headphone jack. Be sure you plug the headphones all the way in, the plastic on the headset jack should be flush with the body of the Nano.
-
the flashing light next too the camera is stays on,can anyone help me with this problem.thanks
Basics from the manual are restart, reset, restore. Have you tried these?
Have you read the manual? -
When I plug in my headphones into my imac only the right side plays music. I tried with other headphones and still has the same problem. I tried the headphones with other devices and they work properly. Can anyone help me with my problem please?
Macs have crazy headpne jacks in different models.
So we know more about it...
At the Apple Icon at top left>About this Mac, then click on More Info, then click on Hardware> and report this upto but not including the Serial#...
Hardware Overview:
Model Name: iMac
Model Identifier: iMac7,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.4 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 4 MB
Memory: 6 GB
Bus Speed: 800 MHz
Boot ROM Version: IM71.007A.B03
SMC Version (system): 1.21f4 -
Good morning. I just purchased Imatch but cannot download my music from an iphone 5 to IMatch in Icloud. Can you help me with this?
Hi
Has iTunes completed its scan of your iTunes library on your computer Subscribing to iTunes from an iOS device.
Jim -
I am using Dreamweaver CS4 and can no longer connect to Device Central - Can you help me with this?
Device Central was discontinued April 23, 2012.
http://www.adobe.com/products/devicecentral.html
And replaced with Adobe Edge Inspect CC (for Cloud subscribers)
http://html.adobe.com/edge/inspect/
Nancy O. -
I run Windows 7 Home Premium on an HP Pavilion dv6. I cannot install iTunes or QuickTime. Can you help me with this?
Hello raadabdaun,
Thanks for the question, and welcome to Apple Support Communities.
I understand you are having issues installing iTunes for Windows. The following article provides the most relevant information and troubleshooting steps:
Trouble installing iTunes or QuickTime for Windows
http://support.apple.com/kb/HT1926
Thanks,
Matt M. -
What will i do..there is a message show, "your device in not more eligible to create a free i cloud acount"..and when i try a new one it ask an account number, but i dont have...can you help me with this issue..?
I try also my old icloud user but its not recognizing the accoun...What will i do..there is a message show, "your device in not more eligible to create a free i cloud acount"..and when i try a new one it ask an account number, but i dont have...can you help me with this issue..?
I try also my old icloud user but its not recognizing the accoun... -
Hi, I'm using a white iPhone 4s with 16gb memory and having some problems. Whenever I use earphones the sound will be heated when the volume is at the highest if I turn it down any lower all I hear is static. Can anyone help me with this problem as I would appreciate it much.
Reset the device:
Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
If that doesn't help, tap Settings > General > Reset > Reset All Settings
No data is lost due to a reset. -
We live in motel but my iMac is not connecting with the internet but my cousin has hp laptop that works perfectly fine in my room. So can you help me with this situation?
Joining an encrypted WEP or WPA Wi-Fi network
-
I just loaded Lion oxs 10.71 on my I-mac computer, and now my Logic 9 software wont show up it says its not compatible also i cant find my macintosh harddrive icon that is usually shown on dektop and device browser column can anyone help me with this problem.
Mike,
I had a similar issue with Photoshop when I upgraded to both Snow Leopard and Lion. it turned out to be Rosetta is no longer present in the newer OS. Once I upgraded to Lion, Appleworks stopped working after all these years. -
I cannot get my pdf files to open can you help me with my problem?
My pdf files will not open can you help me?
I don't know if we can help you. This is almost certainly the wrong forum, but perhaps we can help you there too. Let's start with some questions
1. What software (app) are you using to try to open the PDF files, including version number if you know it?
2. If you are using a browser, what is it?
3. Are you on Mac or Windows?
4. Is the PDF file on your hard drive (own computer), on a web site, or somewhere else?
5. What EXACTLY happens when you try to open the PDF? If you get a message, what is the message IN FULL?
Please answer all questions carefully.
Maybe you are looking for
-
i want to know how to parse an xml doc using javax.xml.parsers i have written a simple ide for java with lots of options and the software would look better if i include xml support. u can find the code below. /* Thank you for your interest in viewing
-
Every time I click on a photo in Iphoto a big exclamation mark appears
So I recently went on vacation and took tons of photos/videos from my Iphone. When I got back home I uploaded them all to Iphoto and when it asked if I want to keep my photos or delete them I accidentally clicked delete. The problem though is that no
-
Hi I have setup a partner profile with outbound parameters having message type WMINVE for inventory counts. But when I am creating a inventory document I dont get the idoc created for the inventory document. I hope the question is clear. If not plea
-
Adding markers for tracks in a mix?
i've recorded a 65 min mix and i want to put markers on each song so it's not just one big long mix. i could only find info for putting markers on podcasts but i'm pretty sure that what i want to do is possible. can anyone help me out?
-
HI, I need to integrate CRM-ECC customer master data. I have the 'FI Customer' role in ECC, but I have not seen a similar BP role in CRM (that allows me to enter Company Code). Where can I find the matching BP roles between CRM-ECC? Any input is very