0% found this document useful (0 votes)
2 views3 pages

Practical Exercise

The document outlines two programming tasks: one for calculating the highest of two numbers using a function, and another for a fitness center application that calculates item prices with discounts and tracks sales. The first task includes a button click event to compare two integers and display the highest and lowest. The second task requires a user interface with text boxes for input, buttons for calculation and clearing, and handling invalid price inputs with message boxes.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Practical Exercise

The document outlines two programming tasks: one for calculating the highest of two numbers using a function, and another for a fitness center application that calculates item prices with discounts and tracks sales. The first task includes a button click event to compare two integers and display the highest and lowest. The second task requires a user interface with text boxes for input, buttons for calculation and clearing, and handling invalid price inputs with message boxes.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Question 3

Design the following form and the write a programme which calculates the highest number, when a
user enter two numbers, it should display the highest number. Use a function in your programme

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As [Link]) Handles


[Link]

[Link]()

End Sub

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles


[Link]

Dim num1 As Integer Dim num2 As Integer

[Link]([Link], num1)

[Link]([Link], num2)

If num1 > num2 Then

Dim temp As Integer temp = num1

num1 = num2

num2 = temp

End If

[Link] = "Lowest:" & [Link](num1) & [Link] & "Highest:" &


[Link](num2)

End Sub

End

Question 4
Develop a programme for “look sharp fitness centre “with one screen shoots that included bellow.
Your application should satisfy the following requirements:  The programme should allow you to
enter the number of items and the price of the items using text boxes only.  Please group the sub
departments with group boxes  The programme must be able to calculate the extended prices, 30%
discount given to the customer, the amount due to the customer and display the answers in the text
boxes.  The programme must display the total sales and number of transactions in the text boxes
only.  Include the following buttons in your programme calculate, clear and exit in your
programme.  The clear button must be able to clear everything in all the text boxes in the above
programme. If all the text boxes are clear the number of items textbox must be in focus  If the price
is invalid it must show the user by the form of messagebox eg [Link]("Invalid price.",
"Data Error")

Public Class BookSaleForm

//Declare the constant.


Const DISCOUNT_RATE_Decimal As Decimal = 0.15D

Private Sub PrintButton_Click(ByVal sender As [Link], _ ByVal e As [Link])


Handles [Link]

//Print the form.

[Link] = [Link] [Link]()

End Sub

Private Sub CalculateButton_Click(ByVal sender As [Link], _ ByVal e As [Link])


Handles [Link]

//Calculate the price and discount.

Dim QuantityInteger As Integer

Dim PriceDecimal, ExtendedPriceDecimal, DiscountDecimal, _ DiscountedPriceDecimal As Decimal

//Convert input values to numeric variables.

QuantityInteger = [Link]([Link]) PriceDecimal =


[Link]([Link])

// Calculate values.

ExtendedPriceDecimal = QuantityInteger * PriceDecimal DiscountDecimal = [Link]( _


(ExtendedPriceDecimal * DISCOUNT_RATE_Decimal), 2)

DiscountedPriceDecimal = ExtendedPriceDecimal - DiscountDecimal

//Format and display answers.

[Link] = [Link]("C") [Link] =


[Link]("N")

[Link] = [Link]("C")

End Sub

Private Sub ClearButton_Click(ByVal sender As [Link], _ ByVal e As [Link])


Handles [Link]

//Clear previous amounts from the form.

[Link]()

[Link]()

[Link]()

[Link]()

[Link]()

With QuantityTextBox .Clear() .Focus()

End With
End Sub

Private Sub ExitButton_Click(ByVal sender As [Link], _ ByVal e As [Link])


Handles [Link]

//Exit the project

[Link]()

End Sub

You might also like