Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: TimeApp

  1. #1
    Member
    Join Date
    Oct 2011
    Posts
    35
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default TimeApp

    can someone give me some help on how to write the following program. I have to calculate how long it would take for 50Mb file to download using a 56k analog modem. A 56k analog modem downloads 5.2 kilo bytes per second. 1 mb=1,024 kb. When finished the program should display how many hours minutes and seconds it would take to download the file. and then try the program on a different amount of MB. Any help would be appreciated. I know how to do the math but i dont know how to get the hours minutes and seconds seperately to display and calculate.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: TimeApp

    Can you explain your problem? If you understand the math, you should be able to compute the hours, minutes and seconds.

  3. #3
    Member
    Join Date
    Oct 2011
    Posts
    35
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Re: TimeApp

    Quote Originally Posted by Norm View Post
    Can you explain your problem? If you understand the math, you should be able to compute the hours, minutes and seconds.
    I dont know how to get the computer to compute the hours and minutes and seconds.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: TimeApp

    how to get the computer to compute the hours and minutes and seconds.
    You need to use some arithmetic expressions and assignment statements.
    You stated: I know how to do the math
    Write the algebraic expressions to compute the total time and then how to compute the hours, minutes and seconds.
    If it takes 155 seconds to do it, what are the hours, minutes and seconds for that? Write down the equations and then convert them to java.

  5. #5
    Member
    Join Date
    Oct 2011
    Posts
    35
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Re: TimeApp

    Quote Originally Posted by Norm View Post
    You need to use some arithmetic expressions and assignment statements.
    You stated: I know how to do the math
    Write the algebraic expressions to compute the total time and then how to compute the hours, minutes and seconds.
    If it takes 155 seconds to do it, what are the hours, minutes and seconds for that? Write down the equations and then convert them to java.
    The math when it is done is 164minutes now my problem is how do i make convert this too: 2 hours 44 minutes and 6 seconds. That is my problem . I have just started Murachs java se 6 book. Kind a new at everything so forgive me if im not writing the problems correctly. Thanks for replies hopes this helps.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: TimeApp

    This problem so far is not about writing any programs or code. Before you write any program you must have decided exactly what the program is to do. For this problem you need to come up with the arithmetic equations to convert a large number of seconds into hours, minutes and seconds.
    If you take paper and pencil how would you do it? Then try to come up with an equation that will do it.
    Then the last thing, think about how to code that equation in java.