Question

Develop a C# UWP application that would have: a text block that reads Enter Current Temperature:...

  1. Develop a C# UWP application that would have:
  • a text block that reads Enter Current Temperature:
  • the text box would follow the text block.
  • 4 buttons:

             One that reads Convert to Celsius

             One that reads Convert to Fahrenheit

             One that reads Clear

             One that reads: Exit

If the user clicks Convert to Celsius button, the temperature entered would be converted to Celsius and the converted temperature would be displayed. If the user clicks Convert to Fahrenheit button, the temperature entered would be converted to Fahrenheit and the converted temperature would be displayed. If the user clicks Clear button, the textbox would be cleared. The user, at this point, would be able to enter new temperature and the conversion process could be repeated till the user clicks Exit button, in which case the application would terminate with a proper message.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//C# code

using System;

using System.Windows.Forms;

namespace tempConverter
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

double temp = 0;
double convertedTemp = 0;

private void btnTempToC_Click(object sender, EventArgs e)
{
if (Double.TryParse(txtTemp.Text, out temp))
{
convertedTemp = (temp - 32) * 5 / 9;
lblResult.Text = "The Temperature is = " + string.Format("{0:0.00}\u00B0C", convertedTemp);
}
else
{
MessageBox.Show("Please enter valid number.");
}
}

private void btnTempToF_Click(object sender, EventArgs e)
{
if (Double.TryParse(txtTemp.Text, out temp))
{
convertedTemp = (temp * 9 / 5) + 32;
lblResult.Text = "The Temperature is = " + string.Format("{0:0.00}\u00B0F", convertedTemp);
}
else
{
MessageBox.Show("Please enter valid number.");
}
}

private void btnClear_Click(object sender, EventArgs e)
{
txtTemp.Text = "";
}

private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

//form design

//Output

//if you need any help regarding this solution ............... please leave a comment ........ thanks

Add a comment
Know the answer?
Add Answer to:
Develop a C# UWP application that would have: a text block that reads Enter Current Temperature:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have...

    C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have 2 Labels (each one of them assigned only to Celsius and Fahrenheit), 2 TextBoxes (each one of them assigned only to Celsius and Fahrenheit), only 1 Convert Button, 1 Clear Button, and 1 Exit Button. Also, 1 Error message label which will display the error messages. The application should only allow the user to enter the desired temperature just in one of the TextBoxes...

  • C# Temperature Converter Application: I have most of the application complete I just need only help...

    C# Temperature Converter Application: I have most of the application complete I just need only help with error messages. My instructor wants me to show four error messages inside an error message label (not a message box) and all of the error messages should appear inside error message label. The four error messages should appear when: 1: User enters data inside both Celsius and fahrenheit text boxes: “You should enter data in only one textbox. Press Clear to start over.”...

  • JAVASCRIPT Write a GUI application that has three labels, two text fields, and two buttons (with...

    JAVASCRIPT Write a GUI application that has three labels, two text fields, and two buttons (with the titles Name and Age). When the program starts the user will enter his/her first name in the first text field and his age in the second text field. When the user clicks the Name button, the first name entered by the user will be displayed as a separate label with the words "CSC210 student at the back of it. When the user clicks...

  • This program will take the user's input as a temperature in degrees Fahrenheit. The user will...

    This program will take the user's input as a temperature in degrees Fahrenheit. The user will then click a radio button indicating whether a table of temperatures, starting with the entered value, will be displayed in increments of 5 degrees F or 10 degrees F. When a submit button is clicked your code will display a HTML table of temperature values. The first column will be temperatures in degrees Fahrenheit, given in increments of 5 or 10 degrees F, depending...

  • Write a program that allows a user to view a table of temperature conversion. The user...

    Write a program that allows a user to view a table of temperature conversion. The user should be able to enter a starting value and an ending value in to textboxes. Your program will display a list of temperature conversion from Celsius to Fahrenheit in a text area like the example below: You can choose any color, design and font for this interface. Use javafx scene builder for program. When you click on "Display" button it read values from text...

  • C# Windows Form Application (CALCULATOR): (This is the instruction below): Windows Calculator that will going to...

    C# Windows Form Application (CALCULATOR): (This is the instruction below): Windows Calculator that will going to create a Windows Form Application that will mimics a calculator. This is the screenshot how it shouldl look like. Calculator It should have a textbox and the following buttons: + Addition - Subtraction * Multiplication / Division = Equals (Will perform the final calculation) C Clear (Will clear the text box) There will be no maximize or minimize buttons. The rules are these: 2...

  • Develop a temperature converter GUI JavaFX application that consists of two labels and two text fields....

    Develop a temperature converter GUI JavaFX application that consists of two labels and two text fields. Typing a temperature into the Celsius field and then pressing the "Enter" key causes the equivalent Fahrenheit temperature to appear in the Fahrenheit field and vice versa. Typing a non-numeric value into either field causes the following error dialog to appear: Formulas are simple:Celsius to Fahrenheit° F = 9/5 ( ° C) + 32Fahrenheit to Celsius° C = 5/9 (° F - 32). O®...

  • *Use Java to create this program* For this assignment, you will be building a Favorite Songs...

    *Use Java to create this program* For this assignment, you will be building a Favorite Songs application. The application should have a list with the items displayed, a textbox for adding new items to the list, and four buttons: Add, Remove, Load, and Save. The Add button takes the contents of the text field (textbox) and adds the item in it to the list. Your code must trim the whitespace in front of or at the end of the input...

  • The Gui has all the right buttons, but from there i get lost. I need to...

    The Gui has all the right buttons, but from there i get lost. I need to know whats wrong with my assignment can someone please help. The code I have so far is listed below, could you please show me the errors in my code. PYTHON Create the GUI(Graphical User Interface). Use tkinter to produce a form that looks much like the following. It should have these widgets. Temperature Converter GUI Enter a temperature (Entry box)                 Convert to Fahrenheit...

  • Visual Basic You are asked to develop a Visual Basic Net application that can determine roots...

    Visual Basic You are asked to develop a Visual Basic Net application that can determine roots of a requirements of this project are as follows: 1) Design a form to allow users to define a quadratic equation and to find the roots of the equation. The form should have a label that shows this message: Solving a quadratic equation ax2+bx+c=0 The form should have three textboxes in which users enter the values of a, b, and c The form should...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT