Project 2 Temperature Conversion 1 Project 2: Temperature Conversion Write an ASP.NET Web Forms app to convert temperatures from Fahrenheit to Celsius and from Celsius to Fahrenheit. The web form should be similar to that shown on the next slide. 2 The Web Form 3 Functional Requiremens The user can enter a decimal number into either TextBox and click the corresponding “Convert” button. The app does the conversion and displays the result in the other TextBox. The user must then click the Clear button before doing anything else. 4 Example User enters 85.2 into the Fahrenheit input box. User then clicks the >> button. 5 Example App displays the corresponding Celsius temperature. Convert buttons and input boxes are now disabled until user clicks Clear. 6 Example User clicks Clear and app returns to initial state. 7 Initial State All buttons are enabled. Both TextBoxes are empty but enabled. User can enter text into either TextBox. After entering text into either TextBox User can change contents of either TextBox. 8 Convert Buttons When the user clicks a “convert” button (<< or >>) If the corresponding input is valid Do the conversion. Put the output into the other TextBox Disable both Convert buttons. Disable both TextBoxes. If the input is not valid Display an error message. Disable both Convert buttons. Disable both TextBoxes. 9 The Clear Button The Clear button should always be enabled. When the user clicks the “Clear” button Revert to the initial state Clear both TextBoxes. Enable both TextBoxes. Clear the Error Message. Enable both “Convert” buttons. 10 Error Example User enters 100c as Celsius input and clicks <<. App displays error message and disables both inputs and both Convert buttons. User must click Clear in order to continue. 11 Specifications Use the C# Decimal type for all numerical values and arithmetic operations. See https://msdn.microsoft.com/en-us/library/364x0z75.aspx https://msdn.microsoft.com/en-us/library/system.decimal.aspx Show conversion results with one decmal place. https://msdn.microsoft.com/en-us/library/0c899ak8(v=vs.110).aspx Page contents should stay centered (left to right) if page is resized. 12 Wider Page 13 Narrow Page 14 Hints and Tips All C# numeric types have a TryParse method and a ToString method. Use an HTML table to control layout. Look these up if you are not familar with them. They will be useful for this project. The buttons will need to be in a table inside a cell of an outer table. OK to use CSS for positioning if you prefer. But it will be complicated! Use CSS to control margins. http://www.w3schools.com/css/css_margin.asp 15 Ground Rules You may work with a partner if you wish. If you do work as a pair or group All members are expected to contribute. All are expected to understand the app in detail. Do not share your code with other students. Or in a group of 3. OK to work alone if you prefer. Before or after submitting the project. It is OK to discuss the project. Do not copy any other student’s work. Don’t look at anyone else’s code Don’t let anyone look at your code. 16 Ground Rules Except for code posted on the class web site Do not copy code from the Internet or any other source. Do not ask for help on an Internet forum. Write your own code. 17 Submission Project is due by 11:59 PM, Monday, February 1. Deliverables: Default.aspx Default.aspx.cs Zip your files and submit the .zip file. Submit your .zip file using the Canvas Assignment for this class. If you work as a pair or a group One student submits the files, with a comment identifying the other students. Other student(s) submit just a comment with the names of group members. 18