Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

code to a tempraturer converter on c# visual studios When the user clicks the bu

ID: 3874589 • Letter: C

Question

code to a tempraturer converter on c# visual studios When the user clicks the button to convert, the first step is to validate the user input in the textbox. Any real number is acceptable. If the user input in the textbox is not a real number, display an appropriate message in the results output label as follows. “ERROR: Please enter a numeric temperature to convert.” If the user input is a real number, store it, then calculate the converted temperature value based on the “convert to” radio button selected. Then display the results in the output label. Follow this example for the appropriate format: “72.4 degrees Fahrenheit converts to 22.44 degrees Celsius.” When the user clicks the button to clear, the form should be reset to its default state, ready for an entry. Hint: there may be things to do other than just clearing both the input textbox and the results output label. When the user clicks the button to exit, the form should close, ending the program. Style Guide To be eligible for full marks on this or any lab in this course your application must conform to the requirements as outlined above and the course Style Guide, in this case making sure to include: Standard course naming rules and conventions. Appropriately declared data types for all possible variables and/or constant(s). Strict adherence to the IPO structure in the most efficient manner possible. Appropriate and complete program documentation.

Explanation / Answer

Code to a Temperature converter:

private void button1_click( object sender, event args e)

{

double celsius =0;

double fahrenheit = 0;

if(radiobutton1.checked)

{

double.TryParse(textbox1.text, out fahrenheit)

{

messagebox.show(" Please Enter a numeric value for Fahrenheit");

return;

}

finalvalue( fahrenheit - 32) * 5/9;

textbox1.text = finalvalue.Tostring();

messagebox.show(" textbox1 degrees Fahrenheit converts to textbox2 degrees Celsius");

}

if(radiobutton2.checked)

{

double.TryParse(textbox2.text, out celsius)

{

messagebox.show(" Please Enter a numeric value for Celsius");

return;

}

double finalvalue= (celsius *9) /5 + 32;

textbox2.text = finalvalue.Tostring();

messagebox.show(" textbox2 degrees Celsius converts to textbox1 degrees Fahrenheit");

}

}

private void buttonreset_click( object sender, event args e)

{

button1. checked = false;

button2.checked = false;

}

private void button1_click( object sender, event args e)

{

Application.Exit();

}

}

In above code we are using two radio buttons for converting temperature Fahrenheit to Celsius and Celsius to Fahrenheit and a message box also displays after converting temperature.

and last application Exit button is also there.