Urgent! Ahhh! Vbnet!

Discussion in 'Computer Science & Culture' started by caffeine_fubar, Jun 2, 2004.

Thread Status:
Not open for further replies.
  1. caffeine_fubar Dark Dementia is my name... Registered Senior Member

    Messages:
    287
    Ok, im doing homework for my class, and its due tomorrow (Its long, havent been procrastinating... much =D)

    I am trying to convert the DOUBLE 9.23 , and get JUST THE .23

    ___________________________________________________________
    Here is the problem:
    Write an algorithm that starts with a quantity in MPH and converts the quantity into minutes and seconds per mile instead of MPH

    Proper answer ffor input of 6.5 MPH=
    9 Mins, 13.8 Seconds

    I use formula =

    MPH = 6.5
    so, Math.Round((60 / MPH), 0)
    That gives me 9 minutes

    THen, to get the seconds its =
    60 / MPH

    I get 9.23........etc
    I want to take JUST THE .23, multiply it by 60

    How do i get the program to realize the numbers ONLY after 9, and then to assign a value to it (easy to assign a value, just what do i use to get the .23?)

    CODE SO FAR:
    Private Sub btnCompute_Click(...<- Dont need this) Handles btnCompute.Click
    Dim Minutes, Seconds, MPH As Double
    Minutes = Math.Round((60 / MPH), 0)

    End Sub
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. caffeine_fubar Dark Dementia is my name... Registered Senior Member

    Messages:
    287
    Found its easier to do this:

    Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
    Dim MPH, Seconds, Step1, Step2 As Double
    Dim Minutes As Integer
    MPH = txtMPH.Text
    Minutes = 60 / MPH


    End Sub

    STILL NO SOLUTION!!!
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. caffeine_fubar Dark Dementia is my name... Registered Senior Member

    Messages:
    287
    Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
    Dim MPH, Seconds, Step1, Step2 As Double
    Dim Minutes As Integer
    MPH = txtMPH.Text
    Minutes = 60 / MPH
    Step1 = (60 / MPH) - Minutes
    Step2 = Step1 * 60
    Seconds = Math.Round(Step2, 3)
    Console.WriteLine("Your speed is... " & Minutes & " Minutes, " & Seconds & " Seconds! ")
    End Sub


    Easy as cake.... Im stupid sometimes =D
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. caffeine_fubar Dark Dementia is my name... Registered Senior Member

    Messages:
    287
    actually.... Minutes = Math.Floor(60 / MPH)

    But whatever, i just made my entire own thread
     
Thread Status:
Not open for further replies.

Share This Page