News book stall gives discount on the books as per following conditions by vs code

  A book stall gives discount on the books as per following conditions:

No. of books purchased                             Discount

a. <=5 Nil                                                         0

b. >5 and <=10                                                10%

c. >10 and <=15                                              12%

d. >15                                                             20%

Create a form as follows to calculate the discount.



Form Design :


Coding:

Dim u_price As Single

Dim n As Single

Dim t_price As Single

Dim discount As Single


Sub pro()

u_price = Val(Text1.Text)

n = Val(Text2.Text)

t_price = n * u_price

Text3.Text = t_price

If n &lt;= 5 Then

discount = 0

ElseIf n &gt; 5 And n &lt;= 10 Then

discount = 0.1 * t_price

ElseIf n &gt; 10 And n &lt;= 15 Then

discount = 0.12 * t_price

Else

discount = 0.2 * t_price

End If

End Sub


Private Sub Command1_Click()

Text1.Text = &quot;&quot;

Text2.Text = &quot;&quot;

Text3.Text = &quot;&quot;

Text4.Text = &quot;&quot;

Text5.Text = &quot;&quot;

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Text3_GotFocus()

pro

u_price = Val(Text1.Text)

t_price = n * u_price

Text3.Text = t_price

End Sub

Private Sub Text4_GotFocus()

pro

u_price = Val(Text1.Text)

t_price = n * u_price

Text4.Text = discount

End Sub

Private Sub Text5_GotFocus()

pro

u_price = Val(Text1.Text)

t_price = n * u_price

Text5.Text = t_price - discount

End Sub


Output :

No comments:

Post a Comment

This Blog helps you to learn basics to high level programming coding and practicals.
conceptual understanding

c program, Advance coding, c++ program, simple program, Advance language

online quiz Application project page MCA final year project

  Here we making a quiz application ppt presentation for college project so that our project idea will like to our professor and teacher  fi...