Crie a classe Copiadora
Public Class Copiadora
Private _Copia As Integer
Public Property Copia
As Integer
Get
Return _Copia
End Get
Set(ByVal value As Integer)
_Copia
= value
End Set
End Property
Public Function
gasto_papel(ByVal c As
Integer) As Double
Return c * 0.02
End Function
Public Function
gasto_tonner(ByVal c As
Integer) As Double
Return c * 0.04
End Function
Public Function
gasto_total(ByVal c As
Integer) As Double
Return gasto_papel(c) * gasto_tonner(c)
End Function
Public Function
lucro() As Double
Return gasto_total(Copia) / 2
End Function
Public Function
cobrar() As Double
Return gasto_total(Copia) + lucro()
End Function
End Class
Aqui é p programa principal
Public Class Form1
Private Sub
btnCalcularValor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnCalcularValor.Click
Dim c As New Copiadora
c.Copia = txtCopias.Text
txtPapel.Text =
c.gasto_papel(txtPapel.Text)
txtTonner.Text = c.gasto_tonner(txtCopias.Text)
txtTotalDespesas.Text
= c.gasto_total(txtCopias.Text)
txtLucro.Text = c.lucro
txtValorCobrar.Text = c.cobrar
End Sub
End Class
Pegue o projeto neste link: http://www.mediafire.com/?1nw5b8mvvhv1219
Espero ter ajudado, até mais... Abraços!
0 comentários:
Postar um comentário