Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Build an application in visual basic based upon the Temperature Converter application code listed below Include the following additions to the Conversion Selection group: Celsius

Build an application in visual basic based upon the Temperature Converter application code listed below

Include the following additions to the Conversion Selection group:

Celsius to Kelvins

Kelvins to Celsius

Fahrenheit to Kelvins

Kelvins to Fahrenheit

Code Listing:

Public Class frmTemperatureConverter

Private Sub frmTemperatureConverter_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

lblConversionInstruction.Text = " "

lblTempOutput.Text = " "

lblInputTempText.Text = " "

lblOutputTempText.Text = " "

txtTempInput.Clear()

radFahrenheitToCelsius.Checked = True

radCelsiusToFahrenheit.Checked = False

End Sub

Private Sub btnConvert_Click(sender As System.Object, e As System.EventArgs) Handles btnConvert.Click

Dim decInputTemp As Decimal

Dim decOutputTemp As Decimal

decInputTemp = Convert.ToDecimal(txtTempInput.Text)

If radCelsiusToFahrenheit.Checked = True Then

decOutputTemp = CelsiusToFahrenheit(decInputTemp)

lblTempOutput.Text = Convert.ToString(decOutputTemp)

lblInputTempText.Text = "Degrees Celsius"

lblOutputTempText.Text = "Degrees Fahrenheit"

ElseIf radFahrenheitToCelsius.Checked = True Then

decOutputTemp = FahrenheitToCelsius(decInputTemp)

lblTempOutput.Text = Convert.ToString(decOutputTemp)

lblInputTempText.Text = "Degrees Fahrenheit"

lblOutputTempText.Text = "Degrees Celsius"

End If

End Sub

Private Function CelsiusToFahrenheit(ByVal decInputTemp As Decimal)

Dim decCelsiusTemp As Decimal

decCelsiusTemp = (decInputTemp * 9 / 5) + 32.0

Return decCelsiusTemp

End Function

Private Function FahrenheitToCelsius(ByVal decInputTemp As Decimal)

Dim decFahrenheitTemp As Decimal

decFahrenheitTemp = (decInputTemp - 32.0) * (5 / 9)

Return decFahrenheitTemp

End Function

End Class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

What do you mean by dual mode operation?

Answered: 1 week ago

Question

Explain the difference between `==` and `===` in JavaScript.

Answered: 1 week ago