Interface and Visual Basic Programming

Total Length: 601 words ( 2 double-spaced pages)

Total Sources: 1

Page 1 of 2

Visual Basic Programming and Interface

The Interface of Average Score Solution

Code

Public Class Form

Private Sub-Form1_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

' calcualtes and displays the average solution ' declare variables

Dim intAllen As Integer

Dim intPeter As Integer

Dim intSmith As Integer

Dim intJohn As Integer

Dim intAverage As Integer

'assign input to variables

Integer.TryParse (txtAllen.Text, intAllen)

Integer.TryParse (txtPeter.Text, intPeter)

Integer.TryParse (txtSmith.Text, intSmith)

Integer.TryParse (txtJohn.Text, intJohn)

' caculate average intAverage = (intAllen + intPeter + intSmith + intJohn) / 4

' display average lblAverage.Text = intAverage.ToString ("CO")

End Sub

End Class

Chapter 7: Question 8.

Code

Public Class Form1

Private Sub-Form1_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

' calcualtes and displays the total sales ' declare variables

Dim intPeter As Integer

Dim intAllen As Integer

Dim intSmith As Integer

Dim intHelen As Integer

Dim intTotal As Integer

'assign input to variables

Integer.TryParse (txtPeter.Text, intPeter)

Integer.TryParse (txtAllen.Text, intAllen)

Integer.TryParse (txtSmith.Text, intSmith)

Integer.TryParse (txtHelen.Text, intHelen)

' caculate total sales intTotal = (intPeter + intAllen + intSmith + intHelen)

' display total sales lblTotal.Text = intTotal.ToString ("CO")

End Sub

End Class

Chapter 8: Exercises 10

Output: Calculate the food's fat calories and its fat percentage

Processing: Calories

Input: Food's fat grams

Number of calories

Each gram of fat contains 9 calories

Algorithms

1.enter the number of grams of fat and calories contained with a specific food.

2 calculate the fat calories "by multiplying the food's fat grams by 9" (Zak, 2014 p 183).


3. "calculate the fat percentage by dividing the food's fat calories by its total calories and then multiplying the result by 100" (Zak, 2014 p 183).

4. if fat percentage display with the zero decimal places

End if

5. display the fat calories

Display the fat percentages

Code

Public Class Form1

Private Sub-Form1_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

' calculates the food fat calories and its fat percentage

Const gram As = 9

Dim intCalories As Integer

Dim decpercentage As Decimal

' assign gram, calories and price to variables

Integer.TryParse (txtGram.Text, intGram)

Integer.TryParse (txtFat.Text, intFat)

Integer.TryParse (txtCalories.Text, intCalories)

Decimal.TryParse (txtPercentage.Text, decpercentage)

' calculate fat percentage the food's fat calories / total calories * 100

intCalories = intGram * 9

intPercentange = intCalories / intCalories x 100

' display fat percentage ' display calories

End Sub

End Class

Chapter 8: Exercises 13

Output: employee net….....

Show More ⇣


     Open the full completed essay and source list


OR

     Order a one-of-a-kind custom essay on this topic


sample essay writing service

Cite This Resource:

Latest APA Format (6th edition)

Copy Reference
"Interface And Visual Basic Programming" (2016, February 23) Retrieved May 8, 2025, from
https://www.aceyourpaper.com/essays/interface-visual-basic-programming-2159854

Latest MLA Format (8th edition)

Copy Reference
"Interface And Visual Basic Programming" 23 February 2016. Web.8 May. 2025. <
https://www.aceyourpaper.com/essays/interface-visual-basic-programming-2159854>

Latest Chicago Format (16th edition)

Copy Reference
"Interface And Visual Basic Programming", 23 February 2016, Accessed.8 May. 2025,
https://www.aceyourpaper.com/essays/interface-visual-basic-programming-2159854