2019年6月4日 星期二

Car_Oil汽車油耗




Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim kilo, liter, price, total, kiloPerliter, literPerkilo, kiloPermoney, moneyPerkilo As Single
        kilo = Val(TextBox1.Text)
        liter = Val(TextBox2.Text)
        price = Val(TextBox5.Text)
        total = price * liter
        kiloPerliter = Math.Round(kilo / liter, 2)
        literPerkilo = Math.Round(liter / kilo, 2)
        kiloPermoney = Math.Round(kiloPerliter / price, 2)
        moneyPerkilo = Math.Round(literPerkilo * price, 2)
        TextBox3.Text = kiloPerliter
        TextBox4.Text = literPerkilo
        TextBox6.Text = kiloPermoney
        TextBox7.Text = moneyPerkilo
        TextBox8.Text = total
    End Sub
End Class


沒有留言:

張貼留言