Download presentation
Presentation is loading. Please wait.
Published byJoshua Reynolds Modified over 8 years ago
1
11 Project 2 Temperature Conversion
2
22 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.
3
3 The Web Form
4
4 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.
5
5 Example User enters 85.2 into the Fahrenheit input box. User then clicks the >> button.
6
6 Example App displays the corresponding Celsius temperature. Convert buttons and input boxes are now disabled until user clicks Clear.
7
7 Example User clicks Clear and app returns to initial state.
8
8 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.
9
9 Convert Buttons When the user clicks a “convert” button ( >) 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.
10
10 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.
11
11 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.
12
12 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/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.
13
13 Wider Page
14
14 Narrow Page
15
15 Hints and Tips All C# numeric types have a TryParse method and a ToString method. Look these up if you are not familar with them. They will be useful for this project. Use an HTML table to control layout. 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
16
Ground Rules You may work with a partner if you wish. Or in a group of 3. OK to work alone if you prefer. 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. 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
17
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
18
18 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.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.