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

Maybe you are looking for

  • Need help in xml

    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

  • Problem generating an IDOC

    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?

  • CRM-ECC BP roles

    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